11-16-2023 05:52 AM - edited 11-16-2023 05:54 AM
Hi,
I followed the BMI270 datasheet and configured the device in normal mode. This is the values in the relevent registers :
With this configuration, I'm able to get accelerometer data, but not gyroscope. Another problem I'm having is converting the raw data into m/s^2. I followed the BMI270-Sensor-API and this is the data processing that I'm doing :
let gravity_earth = 9.80665 as f32;
let half_scale = 32768.0;
let accel_data_x = ((buffer[1] as u16) << 8 | (buffer[0] as u16);
let accel_data_y = ((buffer[3] as u16) << 8 | (buffer[2] as u16);
let accel_data_z = ((buffer[5] as u16) << 8 | (buffer[4] as u16);
let accel_x = (gravity_earth * accel_data_x as f32 * 2.0) / half_scale;
let accel_y = (gravity_earth * accel_data_y as f32 * 2.0) / half_scale;
let accel_z = (gravity_earth * accel_data_z as f32 * 2.0) / half_scale;
let gyro_data_x = ((buffer[7] as u16) << 8 | (buffer[6] as u16);
let gyro_data_y = ((buffer[9] as u16) << 8 | (buffer[8] as u16);
let gyro_data_z = ((buffer[11] as u16) << 8 | (buffer[10] as u16);
let gyro_x = (2000.0 / half_scale) * gyro_data_x as f32;
let gyro_y = (2000.0 / half_scale) * gyro_data_y as f32;
let gyro_z = (2000.0 / half_scale) * gyro_data_z as f32;
11-16-2023 10:04 AM
Hi Butter,
You need to configure 0x7D to enable accel and gyro sensor as can't get gyro data.
11-16-2023 11:54 PM
Hi Robin,
I forgot to mention it, I already set the register 0x7D to 0x06.
11-26-2023 10:39 PM
Is anyone going to reply?
12-27-2023 03:48 AM
Hi Butter,
If you haven't used the BMI270 sensor API & example code(https://github.com/boschsensortec/BMI270-Sensor-API) and the code you designed doesn't work, we suggest you use the sensor API first until it runs well, and then refer to the sensor API for your modifications.