cancel
Showing results for 
Search instead for 
Did you mean: 

LM6S3TR device FIFO pattern incorrect

someguy42
Associate

Hi there!

I'm having issues with my LSM6DS3TR device FIFO. I am trying to read and process all values stored in the FIFO by the accelerometer every interval using I2C. I am doing this by:

1) Retrieving number of unread messages in FIFO at addresses 3Ah and 3Bh.
2) For every unread message:


2.1) Reading the pattern in address 3Ch and 3Dh.
2.2) Reading the value of the FIFO in addresses 3Eh and 3Fh.
2.3) Processing and storing value retrieved from value as x, y or z axis.

 

I assume the pattern will tell me which axis the FIFO value relates to? I am only using the accelerometer, so I assume pattern = 0 is x axis, 1 is y axis and 2 is z axis? However, the pattern seems to be corrupted when I leave the program running long enough and will no longer align with the axis; for example- sometimes it will show pattern 0 but the value will be for y or z axis, pattern 1 but the value is for the x or z... etc...

Further details about the settings of the LSM6DS3TR device:
- I am using only the Accelerometer.
- The FIFO mode is set to continuous and ODR is set to 104Hz.
- The accelerometer ODR is set to 104Hz with no decimation.
- The BDU and IF_INC bits are set to 1 in CTRL3_C.

Does anyone possibly have a solution to this? Thanks in advance.

2 REPLIES 2
Federica Bossi
ST Employee

Hi @someguy42 ,

Once the FIFO is empty, data must not be retrieved from the FIFO_DATA_OUT_L and FIFO_DATA_OUT_H
registers.
It is recommended to read faster than 1*ODR at least three times the number of the enabled FIFO data set in
order to free FIFO slots for the new data: this allows avoiding loss of data.

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 ,

Thanks for your reply. However, I'm still a bit confused by what you mean? In my algorithm, I have obtained the number of unread messages and will only keep reading the FIFO buffer that number of times. That means there should be data in the FIFO still when I read the buffer. Anyway, I added a check for the FIFO_EMPTY bit in address 3Bh, but this does not fix the issue.

Regarding the FIFO read rate, I am reading at a sufficient speed. However, should this not matter if the FIFO is in continuous mode since the old data will just be replaced by new data? For my implementation, I don't mind some data loss.