cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSL does not behave as expected in FIFO continous mode

Jules Patru
Associate

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Miroslav BATEK
ST Employee

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.

View solution in original post

4 REPLIES 4
Miroslav BATEK
ST Employee

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.

Jules Patru
Associate

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

Miroslav BATEK
ST Employee

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

OEl F
Associate

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.