2021-05-26 12:01 AM
I would like to pick up both single and double taps in my application. I have the double tap working but cannot get it to pick up a single tap. In reading the TAP_SRC register , the TAP_IA bit shows a 1 for a double tap but never does for a single tap. however, in the same register, the SINGLE_TAP bit does go high if only tapped once. My understanding is that if I set the WAKE_UP_THS register for the SINGLE_DOUBLE_TAP bit to 1, that they would both be enabled.
This is my first use of this sensor and I am sure I am missing something in setting it up. I have been reading the datasheet and application notes and have not been able to see where I've gone wrong.
I have the interrupts enabled as well.
I appreciate any help or guidance you can give and can provide additional information if needed.
2021-05-27 07:24 AM
Hi @RAtki.3 ,
first of all, are you trying to read both interrupts on INT1?
it could be easier to route the single tap on INT1 and the double tap on INT2.
[In reading the TAP_SRC register , the TAP_IA bit shows a 1 for a double tap but never does for a single tap. however, in the same register, the SINGLE_TAP bit does go high if only tapped once.]
I don't understand well this part, would you like to share the TAP_SRC config in the different moments to let me understand?
can I ask you if the interrupt is latched or not?
Niccolò
2021-05-27 04:51 PM
Hello Niccolo, Thanks for responding.
To answer your question, I am not trying to read both interrupts on INT1.
I read in the application note that TAP_IA in the TAP_SRC register will go high for either a single OR double tap. With the way I have it configured , TAP_IA only goes high for the double tap.
for example:
The TAP_SRC register may read 01011100 when it is double tapped ( the TAP_IA bit being high and the double_tap bit being high.)
During a single tap, it would read 00111100 (the TAP_IA bit staying low and the single_tap bit being high.
As I stated above, I thought that TAP_IA would go high for either a single or double tap.
Hope that makes more sense and I have not confused you further.
In all actuality, I don't need the interrupt pins for my application, I just want to detect either a single tap or a double tap and then do something programmatically dependent on which was detected. That being said, I have tried with the interrupt latched, unlatched, and sending single tap to INT1 and double tap to INT2 even though I don't plan on utilizing them. So what I was doing, was reading the TAP_SRC register and checking to see if TAP_IA was high, if it was, then I was checking to see which tap was detected(either single or double) by reading those bits in the register.
Below is how I have set the registers:
CTRL1_XL (10h) B01100000
TAP_CFG0 (56h) B00001111 --This has been tried with the LIR on and off as well
TAP_CFG1 (57h) B00001100
TAP_CFG2 (58h) B10001000
TAP_CFG3 (59h) B00001100
INT_DUR2 (5Ah) B01111111
WAKE_UP_THS (5Bh) B10000000
Again, the following registers I have tried them on and off with the same results
MD1_CFG (5Eh) B10000000
MD2_CFG (5Fh) B00001000
Thanks,
RAtki
2021-05-28 01:47 AM
Hi @RAtki.3 ,
ok, now I better understand your problem.
the actual situation is that the TAP_IA bit rises even with single tap (and the interrupt is triggered with it) but it returns immediately low to "make room" for a possible double tap event.
so it is normal that you are not able to read it.
as it is stated in the application note on page 5, the single tap interrupt is not latched when active together with the double tap.
anyway, when you read the whole register TAP_SRC you can check for the single bits of single/double tap instead of looking at TAP_IA.
this way you can know which event was triggered.
hope this helps
Niccolò
p.s. if you found the solution to your problem, please, select a best answer to help other users with similar issues
2021-05-28 11:25 PM
Thank you @niccolo.ruffini That makes sense why the TAP_IA bit is unable to be read for a single tap.
I am able to read the TAP_SRC register and check the single/double tap bits to see which event is triggered.
When single tapped, I get a single tap. However, when it is double tapped I first get a single tap indication, then the double tap indication.
I understand why, it senses the first tap as a singletap because the second tap hasn't occurred yet. Once the second tap occurs within the time allowed, it says its a double tap. Do you know of anyway that I can get around this happening? This will be problematic when trying to detect double taps if it sees it as a single tap first. Just wondering if you may have some insight in how to work around this.
Thanks ,
RAtki
2021-05-31 01:03 AM
Hi @RAtki.3 ,
you are right with your analysis.
there is a workaround for your problem: the only way you can differentiate a single tap from the first tap of a double tap is waiting.
I mean that when you receive the interrupt for the single tap, you can start a timer, if by the end of the timer you do not receive the second interrupt that signals a double tap, you know that the first tap was single.
hope this helps
Niccolò