Skip to main content
Visitor II
February 14, 2020
Solved

Sensor axis values are not consistent at higher ODR for LSM6DSO.

  • February 14, 2020
  • 3 replies
  • 1896 views

Hello,

I am currently working with LSM6DSO and FIFO functionality.

When ODR is set at 52Hz, axis values are correct but when I switch to 104Hz or 208Hz, values are not consistent. I have added my sensor configuration code and image to better explanation. Am I missing something in sensor configuration?

lsm6dso_device_id_get(&dev_ctx, &whoamI);
if(whoamI != LSM6DSO_ID)
 while(1);
 
lsm6dso_reset_set(&dev_ctx, PROPERTY_ENABLE);
do {
 lsm6dso_reset_get(&dev_ctx, &rst);
} while (rst);
 
lsm6dso_i3c_disable_set(&dev_ctx, LSM6DSO_I3C_DISABLE);
 
lsm6dso_xl_full_scale_set(&dev_ctx, LSM6DSO_2g);
lsm6dso_gy_full_scale_set(&dev_ctx, LSM6DSO_250dps);
 
lsm6dso_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
 
lsm6dso_fifo_watermark_set(&dev_ctx, 500);
lsm6dso_fifo_stop_on_wtm_set(&dev_ctx, PROPERTY_ENABLE);
 
lsm6dso_fifo_mode_set(&dev_ctx, LSM6DSO_STREAM_TO_FIFO_MODE);
 
lsm6dso_xl_data_rate_set(&dev_ctx, LSM6DSO_XL_ODR_52Hz);
lsm6dso_gy_data_rate_set(&dev_ctx, LSM6DSO_GY_ODR_52Hz);
 
lsm6dso_fifo_xl_batch_set(&dev_ctx, LSM6DSO_XL_BATCHED_AT_52Hz);
lsm6dso_fifo_gy_batch_set(&dev_ctx, LSM6DSO_GY_BATCHED_AT_52Hz);

Data at 104Hz;

0690X00000DAWITQA5.png

    This topic has been closed for replies.
    Best answer by ASoni.2

    Hi @Eleon BORLINI​ , I solved these issues by using FIFO_SENSOR_TAG function. I found this in application note. Data is consistent now and both STREAM TO FIFO and BYPASS TO FIFO modes work as expected.

    Kind regards,

    Aakash Soni.

    3 replies

    ST Employee
    February 21, 2020

    Hi @ASoni.2​ , you set lsm6dso_fifo_mode_set(&dev_ctx, LSM6DSO_STREAM_TO_FIFO_MODE); can you please try to set FIFO_MODE[2:0] at 001: FIFO mode: stops collecting data when FIFO is full? Maybe there is a mismatching between the ODR you set and the FIFO data you are reading. Are you reading data via SPI or I2C, and at which speed? And do you read the FIFO after the watermark is reached (better if you manage the watermark interrupt in some way)? Regards

    ASoni.2Author
    Visitor II
    February 25, 2020

    Hi @Eleon BORLINI​ , I tried setting lsm6dso_fifo_mode_set to FIFO_MODE[2:0] at 001: FIFO mode: stops collecting data when FIFO is full. That works fine. I want to use FIFO_MODE[2:0] at 003: STREAM TO FIFO mode to collect history of data before interrupt event. When I set watermark (lsm6dso_fifo_watermark_set) to 50, 100 or 500 frames, only half of the frames are updated. Each frames has six axes data. Other half gives me frames with same axis value. Same thing happens with BYPASS TO FIFO mode. I have attached code here for the reference.

    I am using I2C mode at 400kHz and I read FIFO after the watermark.

    ASoni.2Author
    Visitor II
    February 25, 2020

    And the data file for above code.

    ASoni.2AuthorAnswer
    Visitor II
    February 26, 2020

    Hi @Eleon BORLINI​ , I solved these issues by using FIFO_SENSOR_TAG function. I found this in application note. Data is consistent now and both STREAM TO FIFO and BYPASS TO FIFO modes work as expected.

    Kind regards,

    Aakash Soni.