Skip to main content
Visitor II
August 8, 2018
Solved

LSM6DSL does not behave as expected in FIFO continous mode

  • August 8, 2018
  • 4 replies
  • 1886 views

Hi Everyone,

I am Using the L6MSDL chip for my application (connected to a STM32L4) in FIFO Continuous Mode and I am having some troubles understanding the FIFO pattern that we can read in FIFO_STATUS3 register.

I configured the LSM6DSL The following way :

-         Accelerometer ODR = Gyroscope ODR = FIFO ODR = 413 Hz

-         No decimation

-         Only accelerometer and gyroscope data sets are stored in fifo

-         BDU Block Update is enabled

-         FIFO Is in continuous mode

I read periodically what is stored in FIFO. To know how much data is stored, I read the FIFO_STATUS1 and FIFO_STATUS2 registers. I make sure to read a multiple of 6 data sets each time (3 gyroscope data and 3 accelerometer data)

I read fast enough so no data is overwritten in fifo. I verify that by checking the overrun status.

My problem is that the pattern that I read from FIFO_STATUS3 is not always equal to 0, even though I read a multiple of 6 data sets each time.

This result in my data sets not being aligned correctly as it should be(X_GYROSCOPE, Y_GYROSCOPE, Z_GYROSCOPE, X_ACCELEROMETER, Y_ACCELEROMETER, Z_ACCELEROMETER).

I tried reading the FIFO_STATUS3 and resetting the FIFO if the pattern value is different then 0, but my data are sometimes not aligned correctly.

Is there any reason why the pattern changes in my case?

Is there any way to ensure that data are always correctly aligned before reading from fifo?

I hope my message is clear.

Thank you.

    This topic has been closed for replies.
    Best answer by Miroslav BATEK

    Please check chapter 8.2.3 in application note AN5040.

    I would recommend you to set a FIFO threshold and read the data only if the threshold in reached.

    I think there might be issue when you are reading the FIFO periodically a the sensor is writing to the FIFO at the same time.

    4 replies

    ST Employee
    August 10, 2018

    Please check chapter 8.2.3 in application note AN5040.

    I would recommend you to set a FIFO threshold and read the data only if the threshold in reached.

    I think there might be issue when you are reading the FIFO periodically a the sensor is writing to the FIFO at the same time.

    Visitor II
    August 11, 2018

    Hello Miroslav.

    Thanks for your answer. I can try that. Will do that after the holidays and come back to you.

    But one more question, if the issue would come from reading the FIFO when some datas are added, will this threshold be enough?

    I mean shall I also enter bypass mode ans stop the current acquisition while reading? I would like to avoid entering bypass mode.

    Thanks for your help !

    Jules

    ST Employee
    August 13, 2018

    No, you don't have to switch to bypass mode.

    Visitor II
    September 3, 2018

    Hello,

    Thank you for the answer.

    I work with Jules and i implemented what u suggested in

    the previous answer. The pattern is now fixed and data sets are always correctly

    aligned.

    However I encountered another problem. I created  this question if u have the time to take a

    look.

    https://community.st.com/s/question/0D50X00009hmIZiSAM/lsm6dsl-fifo-data-set-corrupted

    Thank you.