cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSO Migration from LSM6DSM

rshar.21
Associate II

Hi Everyone,

I'm currently migrating from LSM6DSM to LSM6DSO in my application and facing some issues with accelerometer accuracy in stable conditions.

System Overview:

  • MCU: STM32L4

  • Sensor Interface: SPI (3-wire)

  • Purpose: Reading raw accelerometer and gyroscope data, converting to physical units, and estimating roll/pitch/yaw using MotionFX.

Configuration Details:

   Parameter Value
Acc/Gyro ODR1.6 kHz
FIFO Output Rate400 Hz
Main Loop Rate100 Hz
Averaging4 samples/frame

 

What’s Working:

  • I can successfully communicate with LSM6DSO via 3-wire SPI.

  • I’m able to read raw data from the accelerometer and gyroscope.

  • Sensor fusion (MotionFX) works and outputs roll, pitch, and yaw.

  • With LSM6DSM, I was getting clean and accurate data as expected.

Problem:

  • I'm trying to measure raw linear acceleration (after converting to g).

  • The requirement is that the noise level (in a static, stable condition) should be less than ±0.005g in all directions.

  • With LSM6DSO, the data seems noisier and less accurate, even though I'm using the same processing and averaging method.

 

The Register Configuration of LSM6DSM and LSM6DSO -

rshar21_0-1752843355517.png

rshar21_1-1752843410485.png

 

The flow to read the data from LSM6DSO is 

typedef struct
{
  int16_t acc[3];
}AccRawData_t;
AccRawData_t read_lsm6dso_data;
  
  if((Mems_ID & MEMS_ID_LSM6DSO_ID) == MEMS_ID_LSM6DSO_ID)
  { 
    number_of_words_available = Mems_get_available_samples();
    number_of_samples_available = number_of_words_available;
    Test_noOfwordsAvailable = number_of_samples_available; 
    for (int j = 0; j < number_of_samples_available; j++)
    {
      Mems_get_data_type(&pattern);
      Mems_get_dso_raw_data(read_lsm6dso_data.acc);
      switch(pattern)
      {
        case LSM6DSO_GYRO_DATA_TYPE:
          
          gyro_raw_data[acc_raw_buffer_index].gyro[0] = read_lsm6dso_data.acc[0];
          gyro_raw_data[acc_raw_buffer_index].gyro[1] = read_lsm6dso_data.acc[1];
          gyro_raw_data[acc_raw_buffer_index].gyro[2] = read_lsm6dso_data.acc[2];
          break;
          
        case LSM6DSO_ACC_DATA_TYPE:
          acc_raw_buffer[acc_raw_buffer_index].acc[0] = read_lsm6dso_data.acc[0];
          acc_raw_buffer[acc_raw_buffer_index].acc[1] = read_lsm6dso_data.acc[1];
          acc_raw_buffer[acc_raw_buffer_index].acc[2] = read_lsm6dso_data.acc[2];
          break;
        default:
          dso_fail_count++;
          break;
      }
      acc_avg[0] += acc_raw_buffer[acc_raw_buffer_index].acc[0];
      acc_avg[1] += acc_raw_buffer[acc_raw_buffer_index].acc[1];
      acc_avg[2] += acc_raw_buffer[acc_raw_buffer_index].acc[2];
      gyro_avg[0] += gyro_raw_data[acc_raw_buffer_index].gyro[0];
      gyro_avg[1] += gyro_raw_data[acc_raw_buffer_index].gyro[1];
      gyro_avg[2] += gyro_raw_data[acc_raw_buffer_index].gyro[2];
      
  }

 

 

Kindly help me to fix the acceleration data to get it's Noise level low. 

4 REPLIES 4
Federica Bossi
ST Employee

Hi @rshar.21 ,

It's not expected to be so noisy. Could you try following our examples on GitHub and let me know if that solves the problem?

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
rshar.21
Associate II

Hi @Federica Bossi 

Thanks for you reply and suggestion. I refereed the Github example code(FIFO Read) and implemented in our project. Currently I'm integrating the bluetooth so that by seeing the waveform we can get better idea. 

Meanwhile I'm implementing it, can you suggest any points I should verify(except functional check) so that we can conclude data from both the sensors are same?

Hi @rshar.21 ,

Are the testing environment and the board design the same for the two products?

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Federica Bossi ,

Yes, both have same board and firmware. The only change I can say is the way I read the data in firmware. Do you see any issue in the way I'm reading the data(code snippet I have attached above).