cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DS3TR FIFO Pattern misaligned - is FIFO pattern checking mandatory?

wuyuanyi
Associate II

Hello all,

I am developing a vibration measurement device using LSM6DS3TR-C. Most of the time the data were in good shape (99%).  However, I noticed some spike in my vibration intensity reading randomly. After checking the raw data I saw some step change at the same time point, indicating the data reading of the three axis are confounding.

My configuration only requires the accelometer readings to be cached in FIFO:

1. enable block update

2. set fifo accelometer decimation register to 1 (no decimation)

3. set fifo accelometer data rate to 3333Hz

4. set accelometer data rate to 3333Hz, bandwidth 1.5khz, LPF_BW_SEL to 1

5. set FIFO mode to bypass, then set to FIFO mode (clear and restart FIFO)

6. polling FIFO_STATUS2(0x3B) register for FIFO_FULL_SMART.

7. I2C bulk read the FIFO for 682(sample count) * 3(axis) * 2(16bit-axes) = 4092 bytes from buffer

8. repeat from 5.


To identify the issue, I changed step 7 to the following: 

For i-th reading

7.1 Read the FIFO pattern register (FIFO_STATUS3/4) 

7.2 if i mod 3 != the pattern, print some log. otherwise read the FIFO register and make use the value.

7.3 Repeat 7.1 until the FIFO is depleted.

 

This captures the moment when the axis data getting misaligned. However, this makes the FIFO reading takes much longer (1.2s) than bulk reading (300ms), making it undesired for my application. However, I haven't come up with a reliable detection mechanism for the bulk reading to tell that axis misalignment occured. I checked all status registers and they were exactly the same on both situations.

 

After searching for this forum, there are plently of pending questions about the mistaken/interleaved/buggy FIFO reading. For example,

1. https://community.st.com/t5/mems-sensors/lsm6ds3-fifo-corruption/m-p/694386 

2. Issue with Misaligned Accelerometer and Gyroscope ... - STMicroelectronics Community

3. LSM6DSM- Incorrect Accel Data on high ODR using FI... - STMicroelectronics Community

4. FIFO Corruption on LSM6DSM - STMicroelectronics Community

5. LSM6DS3 FIFO data corruption on random basis. - STMicroelectronics Community

......

Could ST confirm that, it is NOT guaranteed that the FIFO are pushed sequentially in a deterministic fashion, i.e., one MUST read the FIFO pattern  (FIFO_STATUS3/4) before reading each data from the FIFO register (FIFO_DATA_OUT_L/H) to ensure what the next data is, and I2C bulk from FIFO does not guarantee the cyclic pattern of the reading?

If so, I think this should be put on the box! Please mention this on the application note or datasheet. 

5 REPLIES 5
Federica Bossi
ST Employee

Hi @wuyuanyi ,

When the FIFO is used, the IF_INC bit of the CTRL3_C register must be equal to 1. Are you doing this?

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.
wuyuanyi
Associate II

@Federica Bossi Hi Federica, sorry for the late response. The issue is still present and we have no idea how to fix it.

Yes, IF_INC is enabled; BDU is also enabled. I tried many configurations but they all exhibit axis rotating/misaligning/interleaving problem. Should I recognize this as a hardware bug?

wuyuanyi
Associate II

Hello, ST Staff, 

I have collected all information from internet about the misalignment buffer issue and tested out every method suggested by ST members (using ST library, BDU=1, IF_INC=1, watermark, continuous mode / fifo mode, etc.). And I am still stuck with this bug. 

 

When using 3332Hz and FIFO I could never get a clean multi-FIFO reading that does not misalign. Checking the fifo pattern wont work as this shift happend in the middle of batch reading, not at the start. If I need to check every pattern when reading out the FIFO, the I2C won't keep up. Even if the IO was fast enough, what should we do to deal with the missing/disordered sample? Do we have to drop the whole data and resample a new piece?

wuyuanyi_0-1762833486811.png

wuyuanyi_1-1762833524397.png

In fact, after reading the forum post LSM6DSM - Page 1, Now I believe there is firmware/hardware bug in the LSM6 series that was never documented or addressed. This waste tons of our time. If you search for FIFO, almost all post are frustrated about the problematic FIFO reading but NONE of them could fix the problem nor can any provide a constructive suggestion. Can someone from ST please clearify whether this problem is a hardware bug? If so we will avoid choosing this series for the multi-FIFO sampling purpose!

 

 

wuyuanyi
Associate II

Here is the register dump

```

[1762835159] Reg 0x06: 0x00
[1762835159] Reg 0x07: 0x00
[1762835159] Reg 0x08: 0x00
[1762835159] Reg 0x09: 0x00
[1762835159] Reg 0x0A: 0x00
[1762835159] Reg 0x0B: 0x00
[1762835159] Reg 0x0C: 0x00
[1762835159] Reg 0x0D: 0x00
[1762835159] Reg 0x0E: 0x00
[1762835159] Reg 0x0F: 0x6A
[1762835159] Reg 0x10: 0x00
[1762835159] Reg 0x11: 0x00
[1762835159] Reg 0x12: 0x04
[1762835159] Reg 0x13: 0x00
[1762835159] Reg 0x14: 0x00
[1762835159] Reg 0x15: 0x00
[1762835159] Reg 0x16: 0x00
[1762835159] Reg 0x17: 0x00
[1762835159] Reg 0x18: 0xE0
[1762835159] Reg 0x19: 0x00
[1762835159] Reg 0x1A: 0x00
[1762835159] Reg 0x1B: 0x00
[1762835159] Reg 0x1C: 0x00
[1762835159] Reg 0x1D: 0x00
[1762835159] Reg 0x1E: 0x05
[1762835159] Reg 0x1F: 0xC2
[1762835159] Reg 0x20: 0x08
[1762835159] Reg 0x21: 0x00
[1762835159] Reg 0x22: 0x00
[1762835159] Reg 0x23: 0x00
[1762835159] Reg 0x24: 0x00
[1762835159] Reg 0x25: 0x00
[1762835159] Reg 0x26: 0x00
[1762835159] Reg 0x27: 0x00
[1762835159] Reg 0x28: 0x5C
[1762835159] Reg 0x29: 0x10
[1762835159] Reg 0x2A: 0x8C
[1762835159] Reg 0x2B: 0x1A
[1762835159] Reg 0x2C: 0x0C
[1762835159] Reg 0x2D: 0xF8
[1762835159] Reg 0x2E: 0x00
[1762835159] Reg 0x2F: 0x00
[1762835159] Reg 0x30: 0x00
[1762835159] Reg 0x31: 0x00
[1762835159] Reg 0x32: 0x00
[1762835159] Reg 0x33: 0x00
[1762835159] Reg 0x34: 0x00
[1762835159] Reg 0x35: 0x00
[1762835159] Reg 0x36: 0x00
[1762835159] Reg 0x37: 0x00
[1762835159] Reg 0x38: 0x00
[1762835159] Reg 0x39: 0x00
[1762835159] Reg 0x3A: 0x00
[1762835159] Reg 0x3B: 0x10
[1762835159] Reg 0x3C: 0x00
[1762835159] Reg 0x3D: 0x00
[1762835159] Reg 0x3E: 0xE8

```

wuyuanyi
Associate II

For those who reached here after searching. I have my final conclusion: the LSM6 is NOT suitable for using FIFO to acquire multiple FIFO data due to racing condition of concurrent FIFO writting from sensor and FIFO reading from the controller. The ONLY approach that gave me steady clean waveform below is to use spinlock (busy wait) + reading the output registers (28h). It seems 3332Hz ODR is already too much for polling STATUS_REG for new data and one has to control the read-out timing by utilizing the delay timing. I would say it is a huge bummer for this product. After all it failed what the FIFO was designed for: NO BUSY WAITING!

wuyuanyi_0-1762842559167.png