Skip to main content
Visitor II
March 9, 2018
Solved

How to get the acceleration sample corresponds to the exact time when the interrupt is triggered?

  • March 9, 2018
  • 1 reply
  • 2257 views
Posted on March 09, 2018 at 11:44

The LIS3DH is configured to use INT1 to interrupt the MCU when the acceleration value on any of the 3 axis exceed the threshold that is set by the MCU. Firstly, as my understanding, the LID3DH does not stop sampling acceleration data even if the interrupt is triggered (even in stream-to-fifo mode, it does not stop sampling until the fifo gets full). Is this correct? If it's correct, is there a good way to get the acceleration data corresponds to the exact time when the interrupt is triggered? Thanks.

    This topic has been closed for replies.
    Best answer by Miroslav BATEK
    Posted on March 12, 2018 at 15:12

    You understanding is correct and the stream-to-fifo mode is exactly the right mode for the purpose. 

    FIFO content will be composed of #30 samples collected before the trigger event, the sample that has generated the interrupt event and one sample after the trigger.

    Please check chapter 9.3.4 in the application note

    http://www.st.com/content/ccc/resource/technical/document/application_note/77/ed/e7/e1/28/5a/45/d6/CD00290365.pdf/files/CD00290365.pdf/jcr:content/translations/en.CD00290365.pdf

    .

    1 reply

    ST Employee
    March 12, 2018
    Posted on March 12, 2018 at 15:12

    You understanding is correct and the stream-to-fifo mode is exactly the right mode for the purpose. 

    FIFO content will be composed of #30 samples collected before the trigger event, the sample that has generated the interrupt event and one sample after the trigger.

    Please check chapter 9.3.4 in the application note

    http://www.st.com/content/ccc/resource/technical/document/application_note/77/ed/e7/e1/28/5a/45/d6/CD00290365.pdf/files/CD00290365.pdf/jcr:content/translations/en.CD00290365.pdf

    .
    Kefei YaoAuthor
    Visitor II
    March 13, 2018
    Posted on March 13, 2018 at 08:40

    Thanks for the reply. My understanding is a bit different. In AN3308, it describes following about the stream-to-fifo mode:

    0690X0000060A6hQAE.png

    So as my understanding, if the case 2 happens, we are still not able to know where in the fifo the trigger data is. Right? 

    So do I have to read back all the 32 data sample in the fifo and compare to the Threshold I set? The first sample in the fifo that exceed the threshold is the trigger data. 

    ST Employee
    March 15, 2018
    Posted on March 15, 2018 at 16:43

    You are right, in case 2 you want be sure which sample corresponds to the interrupt and you have to compare each sample with threshold. But this case can happen only when you start your measurement, after 32 samples the FIFO will be full and case 1 will happen.