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;
}
... View more