07-10-2023 07:23 PM
Hi, All,
This is the initialisation flowchart in the datasheet of BMI270. However, in the sourcecode of bmi2.c, there is no command send to register 7c and 59 before rslt = write_config_file(dev), why? Thanks in advance.
07-10-2023 07:26 PM
btw, my datasheet is version 1.4.
07-10-2023 08:29 PM
Hi Victor,
First, please keep your datasheet as latestone. Right now is 1.5 🙂
Back to your question, we did all processes for configuration download in our API.
When you check write_config_file, first thing we do is
rslt = bmi2_set_adv_power_save(BMI2_DISABLE, dev);
You can chec that we control 0x7C register inside. 0x59 is same in rslt = set_config_load(BMI2_DISABLE, dev);
Thank you.
07-10-2023 10:40 PM
Thank you very much. The following is the code in file of accel_gyro.c. As you can see write_config_file() is called in bmi270_init() which is before bmi270_sensor_enable() is called, while in bmi270_sensor_enable() , bmi2_set_adv_power_save() is called.
does it mean my baseline software of bmi270 is wrong?
{
/* Status of api are returned to this variable. */
int8_t rslt;
/* Variable to define limit to print accel data. */
uint16_t limit = 10000;
/* Assign accel and gyro sensor to variable. */
uint8_t sensor_list[2] = { BMI2_ACCEL, BMI2_GYRO };
/* Sensor initialization configuration. */
struct bmi2_dev bmi2_dev;
/* Create an instance of sensor data structure. */
struct bmi2_sens_data sensor_data = { { 0 } };
/* Initialize the interrupt status of accel and gyro. */
uint16_t int_status = 0;
uint8_t indx = 1;
float x = 0, y = 0, z = 0;
int16_t angle_speed;
/* Interface reference is given as a parameter
* For I2C : BMI2_I2C_INTF
* For SPI : BMI2_SPI_INTF
*/
rslt = bmi2_interface_init(&bmi2_dev);
bmi2_error_codes_print_result(rslt);
/* Initialize bmi270. */
rslt = bmi270_init(&bmi2_dev);
bmi2_error_codes_print_result(rslt);
if (rslt == BMI2_OK)
{
/* Accel and gyro configuration settings. */
rslt = set_accel_gyro_config(&bmi2_dev);
bmi2_error_codes_print_result(rslt);
if (rslt == BMI2_OK)
{
/* NOTE:
* Accel and Gyro enable must be done after setting configurations
*/
rslt = bmi270_sensor_enable(sensor_list, 2, &bmi2_dev);
bmi2_error_codes_print_result(rslt);