02-19-2024 10:28 AM - edited 02-19-2024 10:39 AM
Hi
I'm using the bmx160 sensor for a project, I can get device ID "0xD8" and write value to register via I2C, but cannot get correct Accel and gyro raw data.
Ex. Get Accel Raw 10 data as bellow by combine LSB with HSB
accel_raw_x = (int16_t)(((uint16_t)xyz_data[15] << 😎 | xyz_data[14]);
accel_raw_y = (int16_t)(((uint16_t)xyz_data[17] << 😎 | xyz_data[16]);
accel_raw_z = (int16_t)(((uint16_t)xyz_data[19] << 😎 | xyz_data[18]);
X: Y: Z-- [ -4608 : 6655 : 5635 ]
X: Y: Z-- [ -9472 : -769 : 18178 ]
X: Y: Z-- [ -4608 : -4353 : 22018 ]
X: Y: Z-- [ -8448 : 3071 : 12803 ]
X: Y: Z-- [ 0 : 512 : 18947 ]
X: Y: Z-- [ -4608 : -1025 : 16386 ]
X: Y: Z-- [ -6912 : -5633 : 6914 ]
X: Y: Z-- [ -12544 : -6401 : 2050 ]
X: Y: Z-- [ -6656 : 1535 : 9731 ]
X: Y: Z-- [ -7424 : -1793 : 514 ]
X: Y: Z-- [ -6656 : -513 : 4610 ]
-----------------------------------------------------------------------------------------------------------------------
Here is my description for how to initialize BMX160 and get Accel and gyro raw data
[Step1]: write 0xb6 to 0x7E for softreset
[Step2]: write 0x11 and 0x15 to 0x7E for Accel and Gyro power normal mode and delay 100ms for each
[Step3]: Read 0x12 to 0x17 and 0x0C to 0x11 for Accel and Gyro
Accel Raw data should be like x=-526, y=254, z=16424, not my raw data have not max z data.
Could you help me figure out what initialization or steps I'm missing?
Thanks for your time
Solved! Go to Solution.
02-20-2024 05:39 PM - edited 02-20-2024 05:39 PM
02-21-2024 07:12 AM
Hi BSTRobin
According to the example code, seems we only need to set these two command to initialize BMX160 for get Accel data,
is that correct ?
BMI160_SOFT_RESET_CMD
BMI160_ACCEL_NORMAL_MODE
int8_t Init_BMI160(struct bmi160_dev *dev)
{
rslt = bmi160_soft_reset(dev);-->BMI160_SOFT_RESET_CMD
dev->delay_ms(200);
.
.
rslt = bmi160_init(dev); -->bmi160_soft_reset(dev);
.
.
/* Set the Power mode */
rslt = bmi160_set_power_mode(dev);-->BMI160_ACCEL_NORMAL_MODE
B.R.
Abner