Skip to main content
LAGOS.1
Associate
Oct 8, 2026 2:44 PM UTC
Solved

LSMDSOX - FIFO Mode how to use it?

Hello,

 

we’re using the LSMDSOX to detect the shocks on external structures designed to monitor geological phenomena.  

We would like to record the acceleration measurements taken immediately before and immediately after the shock into the FIFO buffer.

Ideally, we want the detected shock to be positioned in the “middle” of the 512-element FIFO. Unfortunately, we haven't yet determined the best way to configure the system to achieve this behaviour. We tried setting the sensor to Continuous Mode before entering low-power mode and switching to FIFO Mode upon shock detection - this work fine if the shock event occurs few seconds after low power mode is activated; however, it seems that this causes the FIFO to fill up completely if the wait time in low-power mode exceeds a few seconds.

We would also like to use the Watermark feature, but it is unclear whether the FIFO will consistently resume recording from the moment the shock was detected.

Could someone give any advice?

 

Thank you in advance,

Luca

jiangfan
jiangfanBest answer
ST Employee
Oct 10, 2026 3:30 AM UTC

 

For your use case, I would recommend:

  1. Run the accelerometer continuously

    • maintain a rolling FIFO of pre-event samples
  2. Enable shock detection interrupt

    • use it as the trigger marker
  3. On trigger

    • freeze or snapshot the FIFO state if possible
    • continue collecting a known number of post-event samples
  4. Assemble the event window in software

    • extract pre-shock and post-shock samples from the buffer
    • this is the only way to reliably place the shock near the center of the final record

Important limitation

If your goal is exactly:

  • 256 samples before shock
  • shock in the middle
  • 255 samples after shock

then this is usually a firmware-managed capture problem, not a pure FIFO configuration problem.

NOTE: reviewed answer with help from AI

 

3 replies

jiangfan
jiangfanBest answer
ST Employee
Oct 10, 2026 3:30 AM UTC

 

For your use case, I would recommend:

  1. Run the accelerometer continuously

    • maintain a rolling FIFO of pre-event samples
  2. Enable shock detection interrupt

    • use it as the trigger marker
  3. On trigger

    • freeze or snapshot the FIFO state if possible
    • continue collecting a known number of post-event samples
  4. Assemble the event window in software

    • extract pre-shock and post-shock samples from the buffer
    • this is the only way to reliably place the shock near the center of the final record

Important limitation

If your goal is exactly:

  • 256 samples before shock
  • shock in the middle
  • 255 samples after shock

then this is usually a firmware-managed capture problem, not a pure FIFO configuration problem.

NOTE: reviewed answer with help from AI

 

LAGOS.1
LAGOS.1Author
Associate
Oct 12, 2026 9:25 AM UTC

Thank you very much.

This strategy seems promising. I'll try to verify it on my system, but I'd just like some clarification on the point:

“maintain a rolling FIFO of pre-event samples” 

Does it mean that the FIFO should be configured in “Continuos Mode” when the sensor is in low power?

So, in this case, the microcontroller must read the FIFO immediately after the shock interrupt and then switch again to Fifo mode, after having read all samples. Is it correct?

We don’t need to get the shock event exactly in the center, we only need to have a set of pre and post-event samples. 

jiangfan
ST Employee
Oct 13, 2026 1:42 AM UTC

Yes, I agree with you.