2024-04-30 07:11 AM - edited 2024-04-30 07:25 AM
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!