cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3DH: INT2_CFG - LIR affects INT2 pin signal when configured for position recognition

JuliaMidori2iot
Associate

I'm trying to figure out if a latched interrupt affects the INT pin signal. I'm working with Arduino. The datasheet says the following on page 44:

AOI-6D = ‘11’ is direction recognition. An interrupt is generated when the orientation is
inside a known zone. The interrupt signal remains while the orientation is inside the zone.

I understand that latched interrupt makes the IA bit on INTx_SRC stay HIGH until i read the register.
But when I enable LIR, this doesn't seem to be true.

Before configuring everything, I reset all the registers to default value. 

I configured INT1 without LIR and INT2 with it to check the difference.

I put a LED on each INT pin.

Here's the configuration code:

write_reg(LIS_ADD, CTRL_REG1, 0x97); // 0x97: 1344 Hz, enable XYZ
write_reg(LIS_ADD, CTRL_REG2, 0x00); // 0x00: HP off
write_reg(LIS_ADD, CTRL_REG3, 0x40); // 0x40: IA1 on INT1
write_reg(LIS_ADD, CTRL_REG4, 0x30); // 0x30: 16g
write_reg(LIS_ADD, CTRL_REG5, 0x02); // 0x08: LIR_INT1, 0x02: LIR_INT2
write_reg(LIS_ADD, CTRL_REG6, 0x20); // 0x20: IA2 on INT2

write_reg(LIS_ADD, INT1_CFG, 0xFF); // 0xFF: postion detection XYZ(H+L)
write_reg(LIS_ADD, INT2_CFG, 0xFF); // 0xFF: postion detection XYZ(H+L)


write_reg(LIS_ADD, INT1_THS, 0x02);
write_reg(LIS_ADD, INT1_DURATION, 0x20); // 24 ms (1344 Hz)
write_reg(LIS_ADD, INT2_THS, 0x02);
write_reg(LIS_ADD, INT2_DURATION, 0x20); // 24 ms (1344 Hz)


What I get is: 

  • LED on INT1 pin is turned on every time i get an interrupt. It seems to be working correctly;
  • LED on INT2 pin, on the other hand, is working weirdly. Sometimes it just doesn't turned on at all, sometimes it's always turned on.
  • I printed INTx_SRC on the serial monitor: IA on INT1_SRC is correct. IA on INT2_SRC is almost never HIGH.

Is that the expected behavior? Does LIR really conflict with the position recognition configuration? 

1 ACCEPTED SOLUTION

Accepted Solutions
Federica Bossi
ST Employee

Hi @JuliaMidori2iot ,

Welcome to ST Community!

The configuration you did seems correct. In case you would like to verify it, you could check out this similar example using STM32 tools.You could also check section 6.4 on this application note that shows and example of using a latched interrupt in another context to check if it works with your current setting.

Considering your specific implementation, did you try reducing the threshold and the duration to check the behavior of the latched interrupt?  

You could also try checking if the same intermittent behavior is seen using the movement recognition configuration and not the direction recognition configuration of the interrupt. 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Federica Bossi
ST Employee

Hi @JuliaMidori2iot ,

Welcome to ST Community!

The configuration you did seems correct. In case you would like to verify it, you could check out this similar example using STM32 tools.You could also check section 6.4 on this application note that shows and example of using a latched interrupt in another context to check if it works with your current setting.

Considering your specific implementation, did you try reducing the threshold and the duration to check the behavior of the latched interrupt?  

You could also try checking if the same intermittent behavior is seen using the movement recognition configuration and not the direction recognition configuration of the interrupt. 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.