BMI270 Configuration and Data Processing

Hi,

I followed the BMI270 datasheet and configured the device in normal mode. This is the values in the relevent registers :

  • Register 0x40 = 0xA8
  • Register 0x41 = 0x00
  • Register 0x42 = 0xA9
  • Register 0x43 = 0x00
  • Register 0x7C = 0x02

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;

 

 

 

4 replies