cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSL 8 Bit Mode FIFO reads

GRagh
Associate II

I have configured the part to do 8 bit reads of Acceleration and Gyro. Using the FIFO in continuous mode with a watermark of about 1700. I am using I2C interface.

First I determine the number of words in the FIFO.

Read both the high and low bytes of the FIFO for the number of words -> This works fine

Now I read the high byte register continuously and then the low byte register continuously (multiple sequential reads without address in between) -> This gives me weird results.

What am I doing wrong ?

Thanks

3 REPLIES 3
Eleon BORLINI
ST Employee

Hi @GRagh​ , I don't know if I'm catching the point... You are filling the FIFO in continuous mode and, when the threshold is reached, the data are read in MSB+LSB pr in multiple MSB and multiple LSB mode... right? Did you maybe set the BDU bit in reg CTRL3_C (12h)?

0690X00000ARFcVQAX.png

Regards

See also https://community.st.com/s/question/0D50X0000BB03dHSQR/fifo-corruption-on-lsm6dsm

Is there some worked demo code that shows the FIFO working, and stresses it?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
GRagh
Associate II

Eleon,

I did the following experiment. Gyro ODR is 416 Hz, Accel ODR is 416 Hz and FIFO ODR is 416 Hz.

I read the register FIFO_STATUS3 (0x3C) to see the order of data coming from FIFO. I expect to see 0,1,2,3,4,5,0,1,...

This happens correctly for a while. After about 100k samples, I see the following coming out the FIFO_STATUS3 register:

0,1,2,223,194,165,136,107,78,239,210,181,152,123,94,249,220,191,162,133,104,27,254,225,196,167,138,61,32,3,230,201,172,71,42,13,240,211,182,81,52,23,250,221,192,163,86,57,28,255,226,197,120,91,62,33,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1

How can I get numbers like 223 and 194 ? This happens at various times sometimes soon and sometime after a lot of samples (~100k+). This happens for a variety of gyro/accel ODR and FIFO ODR combinations. I have tried 3-4 variations and all of them die. I have also tried 16 bit and 8 bit combinations with the same result.

Do you have any thoughts on how to fix this or avoid this problem ? I don't mind checking this and throwing away some data but how do i know that this does not happen for say 1000 samples in between - which would make my data have large gaps.

Please advise

gopal