03-24-2022 09:32 PM
Hi,
I use BMI160 with STM32F4. I have driver from Bosch Sensortec (https://github.com/BoschSensortec/BMI160_driver) but i cannot get true value from sensor. I want to get gyro and accel values for x, y and z. I initialize the sensor. You can see here:
Then, I want to use these values from bmi160_defs_h:
But i get an error: 'x', 'y', 'z' undeclared, first use in this function. How can i fix it?
Please help.
03-24-2022 10:55 PM
Hi,
Thanks for your inquiry.
After power on both BMI160 accel and gyro are in suspend mode. You need to write value of 0x11 to command register 0x7E to bring accel to normal mode and wait 5ms for the accel to be stabilized. Then you can write value of 0x15 to command register 0x7E to bring gyro to normal mode and then wait 55ms for the gyro to be stabilized. Then you can read those data registers to get the values from accel and gyro measurements.
Please refer to the example code on the Github at https://github.com/BoschSensortec/BMI160_driver/blob/master/examples/read_sensor_data/read_sensor_da... for more information.
Thanks.
03-25-2022 11:25 PM
Hi,
Thanks for your help.
Now, I am getting accel and gyro values but they are all 0. How can i fix it?
Please help. Thanks.
03-26-2022 12:56 AM
03-27-2022 08:30 PM
Hi again,
I am sorry about that but i couldn't again. I check your example code and read your PDF. I initialize them but i get an "undefined reference" error. For example "undefined reference to init_sensor_interface". You can see here my init functions:
And if "rslt == BMI160_OK", i read from my serial screen "BMI160 initialization success!" but if it is not, i read "BMI160 initialization fail!". So my "BMI160_OK" is not true. Also my gyro and accel values are still 0. Because of initialization, i guess. So, what can i do? It is so important for me.
Thanks.