03-04-2021 12:48 AM
After a success CRT (GYR_GAIN_STATUS.g_trig_status reports a successfull CRT run), I tried to get the new gyro gain values from below locattions:
- register 0x78, 0x79, 0x7A
- GYR_GAIN_UPD_1, GYR_GAIN_UPD_2, GYR_GAIN_UPD_3 in page 1
But all values are "0".
I wonder how to get the new gyro gain values, wihch will be programmed to NVM later. Thanks.
Solved! Go to Solution.
03-05-2021 04:39 AM
Hi,
The formal BMI270 API include crt process, so you could compare your code with this API to confirm if the crt done and sucess.
And then, you could check the GYR_GAIN_UPD_1, GYR_GAIN_UPD_2, GYR_GAIN_UPD_3 in page 1.
Best regards.
03-07-2021 11:53 PM
Hi,
Yes, the CRT is done and success by verifying GYR_GAIN_STATUS.g_trig_status.
But the reading value of GYR_GAIN_UPD_1, GYR_GAIN_UPD_2, GYR_GAIN_UPD_3 in page 1 are always "0".
03-08-2021 09:45 AM - edited 03-08-2021 09:58 AM
Hi,
I test BMI270 CRT and read gain val with BMI270 API, code and log as bellow. So, please review BMI270 API code to check your process.
Another suggestion, during make CRT if move your board, please check the CRT fail status.
Running example 'bmi270_execute_crt.exe' ...
ratio_x:0, ratio_y:0, ratio_z:0,
CRT completed successfully
ratio_x:6, ratio_y:116, ratio_z:119,
Operation finished successfully
/* This function starts the execution of program */
int main(void)
{
/* Structure to define BMI2 sensor configurations */
struct bmi2_dev bmi2;
/* Variable to define result */
int8_t rslt;
/* Bus configuration : I2C */
#if BMI270_INTERFACE_I2C == 1
/* To initialize the hal function */
bmi2xy_hal_i2c_init();
bmi2.dev_id = BMI2_I2C_PRIM_ADDR;
bmi2.intf = BMI2_I2C_INTERFACE;
bmi2.read = bmi2xy_hal_i2c_bus_read;
bmi2.write = bmi2xy_hal_i2c_bus_write;
/* Bus configuration : SPI */
#elif BMI270_INTERFACE_SPI == 1
/* To initialize the hal function */
bmi2xy_hal_spi_init();
bmi2.dev_id = SPI_CS;
bmi2.intf = BMI2_SPI_INTERFACE;
bmi2.read = bmi2xy_hal_spi_bus_read;
bmi2.write = bmi2xy_hal_spi_bus_write;
#endif
bmi2.read_write_len = 32;
bmi2.delay_us = bmi2xy_hal_delay_usec;
/* Config file pointer should be assigned to NULL, so that default file address is assigned in bmi270_init */
bmi2.config_file_ptr = NULL;
/* To Initialize bmi270 */
rslt = bmi270_init(&bmi2);
print_rslt(rslt);
#if (CRT_CHECK==1)
struct bmi2_gyro_user_gain_data g_usr_gain;
g_usr_gain.x = g_usr_gain.y = g_usr_gain.z = 0;
#endif
if (rslt == BMI2_OK)
{
// ZYC, 20210308
#if (CRT_CHECK==1)
if (rslt == BMI2_OK)
// if ((rslt == BMI2_OK)/* && (user_gain != NULL)*/)
{
/* Get the user gain */
bmi2_read_gyro_user_gain(&g_usr_gain, &bmi2);
printf("\r\n ratio_x:%d, ratio_y:%d, ratio_z:%d, ", g_usr_gain.x, g_usr_gain.y, g_usr_gain.z );
}
#endif
/* This API is to run the CRT process */
/* Do not shake the board for CRT test. If so, it will throw an abort error */
rslt = bmi2_do_crt(&bmi2);
print_rslt(rslt);
if (rslt == BMI2_OK)
{
printf("\r\n CRT completed successfully");
}
// ZYC, 20210308
#if (CRT_CHECK==1)
if (rslt == BMI2_OK)
// if ((rslt == BMI2_OK)/* && (user_gain != NULL)*/)
{
/* Get the user gain */
bmi2_read_gyro_user_gain(&g_usr_gain, &bmi2);
printf("\r\n ratio_x:%d, ratio_y:%d, ratio_z:%d, ", g_usr_gain.x, g_usr_gain.y, g_usr_gain.z );
}
#endif
}
return rslt;
}
03-15-2021 07:03 AM
Hi Yanchao,
Thanks for your help. Yes, I got the gyro gain values from 0x78, 0x79 and 0x7A now.
I wonder how to interpret the these values into Sensitivity Scalar? Thanks.