2026-04-21 5:10 AM - edited 2026-04-21 10:38 PM
I am using STEVAL-MKI109D + STEVAL-MKI238A. I have evaluated motion-stationary FSM example as it seemed closest to what we want to use for our application. It seems to work fine, however it is too sensitive and needs some upgrades.
What I want to achieve:
Setup timer (TI3) to some value such such as 5 seconds. During this 5 second period, I want to detect specific number of events above certain threshold (GNTH1). If specific number of events were detected during 5 second period, generate an interrupt and repeat over and over again. If specific number of events were not detected during that 5 seconds period, just reset the counter and repeat.
My cofiguration:
It sounds like a simple requirement but I cannot achieve it using FSM.I tried to achieve this using 2 FSM's:
FSM1:
FSM1 is responsible for incrementing long counter everytime the GNTH1 is reached.
FSM2:
FSM2 is responsible for resetting long counter. I don't really understand why the MEMS Studio forces me to put STOP command at the end of the FSM2. Will it halt the FSM2 and could that cause any issues? I have tried to remove this command and click "Write FSM configuration to sensor" but then the STOP command automatically appears again at the end...
The results are below:
For some reason, the INT2 latches and does not reset. I cannot wrap my head around why it does not reset even though my FSM2 has RSTLC.
I also notice this in the datasheet:
If any of the programs makes use of the long counter through the commands described above, the FIFO must be
enabled in continuous mode. Refer to AN5909 for more details on the FIFO buffer
Does that mean I need to use FIFO?
I have tried to enable and select Continuous mode. When I go to FSM Testing tab and move the device and Read the FSM_LONG_COUNTER register value, I see its stuck at 0014 and its not being reset back to 0 after period so it seems that its also not working
I am also attaching FSM_files.zip if you want to check my FSM configuration.
So to summarize my question:
1. Why the INT2 latches when the Long counter reaches its threshold value and why does my FSM2 RSTLC
not able to reset it?
2026-04-29 12:29 AM
Hi @LPetr.1 ,
Hello,
We checked your configuration and we mostly agree on what you did.
We would like to provide additional details on your configuration and explain the behavior you observed:
Best regards