cancel
Showing results for 
Search instead for 
Did you mean: 

How can I resiliently read from FIFO on LSM6DS3/LSM6DSL/LSM6DSM?

JRows.1
Associate

I am running on linux and trying to collect accel and gyro samples from the IMU. I have configured the IMU to store data in the FIFO so I can read data periodically without missing any samples.

I have tried both FIFO mode and continuous mode but I can't find any way to address to reliably determine if the FIFO fills up and stops collecting data.

The main problem is that I have to separately read the FIFO status registers to determine how many samples are available in the FIFO and check any status flags. Then I have to read the FIFO data out registers to read FIFO samples. There are multiple warnings in datasheets and application notes to not read more data from the FIFO than is available, so reading FIFO status and reading FIFO data must be done separately.

My problem is that I could read the FIFO status registers and see that the FIFO is not full, and then between that time and the time that I read the FIFO data out registers, the FIFO might have filled up.

If the IMU is running in FIFO mode then data stops being added to the FIFO, but there's no indication in any register that the FIFO has stopped.

If the IMU is running in continuous mode, then the data may have been overwritten.

The FIFO status flags that indicate that the FIFO is full or had overwritten data are cleared when FIFO data is read, so if I read FIFO status again after reading FIFO data, those status flags won't show that the FIFO reached full.

Is there any persistent state that will show that the FIFO reached full even if the FIFO data buffers were read after the FIFO is full?

Is there any register that can be read to show when the FIFO in FIFO mode has stopped writing data?

0 REPLIES 0