Skip to main content
Graduate II
April 30, 2024
Question

LSM6DSL FIFO stops working after fifty-odd reads

  • April 30, 2024
  • 1 reply
  • 1016 views

Folks,

I have an STM32 rigged up via SPI to read gyro data-only from an LSM6DSL. 

I read it periodically, every 20ms, and for a while it will report back a few hundred samples in FIFO STATUS REG 1 and 2; I empty the FIFO and after another 20ms it reports me a few hundred samples available and so on. After a short time though it reports no samples in the FIFO and after that it will never have any data to report until I reset and restart.

Is there a technique for this? Can I not just read out every so often? We don't have the interrupt line connected to the micro, so it has to be done on a polling basis.

I can imagine that maybe if you didn't empty the FIFO quickly enough that there might be a bug in the silicon and it might always read back zero, *but* I have set watermark to 2048 and stop on full, yet it still falls over.

This is at 1.66k ODR (both gyro AND FIFO). If I run it st a slower ODR it works OK.

At 833Hz, the next rate down, I always get 108 or 111 samples to read (which I am assuming is x, Y and Z axes and I have to throw away 0,1, 3, 4 etc etc to get Z axis only). At a higher ODR the number of available samples is all over the places.

So am I doing something wrong? Is the gyro not fit for purpose using FIFO at this ODR? Also is there a way of "resetting" the FIFO witout having to reset and reinitilaise the whole unit?

Thanks!

 

    This topic has been closed for replies.

    1 reply

    Visitor II
    September 16, 2025

    We're having a very similar issue. Did you manage to fix this @DiBosco ?


    @DiBosco wrote:

    Also is there a way of "resetting" the FIFO witout having to reset and reinitilaise the whole unit?

     


    Regarding this, we've found that on our case when the FIFO stops working the FIFO_CTRL4 register FIFO mode is set to 0 (bypass) instead of 6 (continuous, which is the mode we had configured). We've found that setting the mode back to continuous (by just writing "6" to the corresponding field of the FIFO_CTRL4 register) makes the IMU start sampling again.

    DiBoscoAuthor
    Graduate II
    September 16, 2025

    I *think* the SPI clock was running too slowly. Is a long time ago now, but that is what I seem to remember. I don't think we ended up resetting the gyro.