cancel
Showing results for 
Search instead for 
Did you mean: 

Clarification on LIS3DH Event detection

Rajeev Piyare
Associate III

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

3 REPLIES 3
Eleon BORLINI
ST Employee

Hi @Rajeev Piyare​ , right, you have two ways to detect an event:

  1. "hardware", enabling the event detector routing of the on the device INT1 or INT2 pad, and managing it via MCU (you can use the mcu interrupt vector)
  2. "software", polling a device register, in this case INT1_SRC (31h) or INT2_SRC (35h), depending on the chosen interrupt path.

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

Thanks @Eleon BORLINI​  for clarifying my doubts. This makes life easier at my end.

Regards

Rajeev

Rajeev Piyare
Associate III

Hi @Eleon BORLINI​ ,

In order to detect events though LIS3DH interrupt pins, two of the main parameters are

  1. Threshold value (INTx_THS)
  2. INTx_DURATION

0690X00000DXSuFQAX.png

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