Algoritm reading FIFO LIS3DH
In my project, I used the LIS3DH chip. Most of the time the processor sleeps.
The processor wakes up on time and on exceeding the shock threshold.
In case of awakening on shock threshold, I need to read the data from the FIFO buffer (32 measurements) that were before the wake-up signal
and a series of measurements (600-32) after waking up.
How could I do this?
Now I am reading the measurements while waiting for the ZYXDA register ready bit STATUS_REG(27h) set. FIFO always enabled in Stream mode.
But this metod may not work when reading the FIFO part of the measurements. Should I change the read algorithm when reading data from FIFO?
I think this is the algorithm:
1. Read FIFO 32 measurements on wakeup by observing the EMPTY bit of the FIFO_SRC_REG(2Fh) register
2. Disable FIFO by resetting FIFO_EN register CTRL_REG5(24h)
3. Read 600 - 32 measurements waiting for ZYXDA bit STATUS_REG(27h)
Or is it possible somehow easier?
In the DocID17530 Rev 2 and AN3308 documentation, I did not find an answer to the question of how the ZYXDA bit of the STATUS_REG (27h) register behaves when reading FIFO
