2020-02-20 09:53 AM
Going over the application note AN3308 (Pg:27), step 9 depicts that in order to detect event, for example, free-fall, poll INT1 pad. This means checking the the physical status of the MCU pin to which INT1 pin is connected.
However, looking at the example codes provided by ST for free fall detection, it says read INT pin 1 in polling mode
or read src status register.
/*
* Check INT 1 pin or read source register
*/
lis3dh_reg_t all_source;
lis3dh_int1_gen_source_get(&dev_ctx, &all_source.int1_src);
if (!(all_source.byte & 0x3f))
{
sprintf((char*)tx_buffer, "freefall detected\r\n");
tx_com(tx_buffer, strlen((char const*)tx_buffer));
}
This tells me that even if I have not connected the INT1 pin to the MCU but reading the interrupt source (LIS3DH_INT1_SRC) register of LIS3DH via I2C is enough for detecting events?
A clarification on this will solve my dilemma.
Thanks
2020-02-21 06:27 AM
Hi @Rajeev Piyare , right, you have two ways to detect an event:
In your case, you are right, if you don't have restrictions on synchronicity you can simply poll the INT register to check if the interrupt flag is high or not.
Regards
2020-02-23 07:14 PM
Thanks @Eleon BORLINI for clarifying my doubts. This makes life easier at my end.
Regards
Rajeev
2020-02-27 07:46 AM
Hi @Eleon BORLINI ,
In order to detect events though LIS3DH interrupt pins, two of the main parameters are
However, I am having a bit of difficulty in interpreting these values. How does the value for instance 0x10 translates to threshold of 250mg and 0x03 to duration of ~30ms.
This clarification will help me to set these desired parameters accurately for my application.
Thanks