cancel
Showing results for 
Search instead for 
Did you mean: 

FSM double tap

SamuPre
Associate

Hi, I'm trying to implement the tap and double-tap function in the FSM tab. Is it possible to achieve this at an output data rate of 26 Hz?

 
1 ACCEPTED SOLUTION

Accepted Solutions
Andrea VITALI
ST Employee

Tap and double tap are already supported by the sensor, with no need to write a custom FSM program to do that. For example LSM6DSV16X has it, check AN5763 section 5.5.

Of course, it would be easy to mimic the functionality with an FSM program. The program is a sequence of reset/next pairs, where the control will go back to the reset pointer when a condition is met, otherwise would move to the next paid when that other condition is met. Again for LSM6DSV16X check AN5882.

In the following I assume the mask has enabled all axes, X Y Z, in the positive and negative direction; unsigned comparison SSIGN0, 

First of all, you should start from a known condition, so first instruction could be SRTAM1 to monitor the axes set in the mask, and then GNTH1|TI1, meaning that if any axis is above threshold1 the program should reset, and move to the next instruction only if this is not happening (all axes are below threshold1) for the time specified by timer1. In practice, we wait for a quiet condition before detecting the tap.

Next, we issue the SRTAM0 instruction because we want to track the axis that will trigger the threshold and then NOP|GNTH2 meaning that we wait for any axis to be above threshold2 to move to the next instruction. Threshold2 is the minimum tap intensity.

Next instruction could be TI3|LNTH2 meaning that we wait for the same axis (because of SRTAM0) to go back below threshold within the timer3 interval; otherwise the program will reset because this is not a tap, but motion lasting more than timer3 interval.

At this point the tap detection is completed, and you can trigger the interrupt and reset (CONTREL).

Another program that can run in parallel would do the same but continue as follows to perform double tap detection: SRTAM1 then NOP|TI4 where we simply wait for timer4 to expire. This is the de-bouncing period where we wait for vibrations to die out. Then GNTH1|TI1 which as explained above is the expected quiet condition before another tap happens.

Then we can do SRTAM0, TI2|GNTH2 meaning that we are going to reset after the timer2 interval unless any axis goes above threshold2 which is the second tap we are waiting for. If the second tap happens too late then it is not counted as double tap. And then TI3|LNTH2 we wait for the same axis to go back below threshold. 

Finally, we perform debouncing with SRTAM1, NOP|TI4, and then we wait for the quiet period long after the second tap with GNTH1|TI1. If this is met, then the last instruction, CONTREL, will trigger the interrupt and reset the program.

 

Next instruction could be LLTH1

View solution in original post

1 REPLY 1
Andrea VITALI
ST Employee

Tap and double tap are already supported by the sensor, with no need to write a custom FSM program to do that. For example LSM6DSV16X has it, check AN5763 section 5.5.

Of course, it would be easy to mimic the functionality with an FSM program. The program is a sequence of reset/next pairs, where the control will go back to the reset pointer when a condition is met, otherwise would move to the next paid when that other condition is met. Again for LSM6DSV16X check AN5882.

In the following I assume the mask has enabled all axes, X Y Z, in the positive and negative direction; unsigned comparison SSIGN0, 

First of all, you should start from a known condition, so first instruction could be SRTAM1 to monitor the axes set in the mask, and then GNTH1|TI1, meaning that if any axis is above threshold1 the program should reset, and move to the next instruction only if this is not happening (all axes are below threshold1) for the time specified by timer1. In practice, we wait for a quiet condition before detecting the tap.

Next, we issue the SRTAM0 instruction because we want to track the axis that will trigger the threshold and then NOP|GNTH2 meaning that we wait for any axis to be above threshold2 to move to the next instruction. Threshold2 is the minimum tap intensity.

Next instruction could be TI3|LNTH2 meaning that we wait for the same axis (because of SRTAM0) to go back below threshold within the timer3 interval; otherwise the program will reset because this is not a tap, but motion lasting more than timer3 interval.

At this point the tap detection is completed, and you can trigger the interrupt and reset (CONTREL).

Another program that can run in parallel would do the same but continue as follows to perform double tap detection: SRTAM1 then NOP|TI4 where we simply wait for timer4 to expire. This is the de-bouncing period where we wait for vibrations to die out. Then GNTH1|TI1 which as explained above is the expected quiet condition before another tap happens.

Then we can do SRTAM0, TI2|GNTH2 meaning that we are going to reset after the timer2 interval unless any axis goes above threshold2 which is the second tap we are waiting for. If the second tap happens too late then it is not counted as double tap. And then TI3|LNTH2 we wait for the same axis to go back below threshold. 

Finally, we perform debouncing with SRTAM1, NOP|TI4, and then we wait for the quiet period long after the second tap with GNTH1|TI1. If this is met, then the last instruction, CONTREL, will trigger the interrupt and reset the program.

 

Next instruction could be LLTH1