AnsweredAssumed Answered

[SOLVED] LIS3DH on I2C:  setting Activity Interrupt

Question asked by Eric Tsai on Jun 9, 2018

[EDIT] Solved!  I missed where the app note mentioned that I have to set REG3's <I1_IA1> bit.  Once that's done, I get interrupts on motion.

"App Note AN3308"

 

Hello,

I'm trying to enable interrupt on a LIS3DH using mBED, on a nRF51822.  Here's the program for reference:

 

Main:  AA_LIS3DH_I2C - Debugging I2C | Mbed 

LIS3DH.cpp:  LIS3DH - debugging library | Mbed 

 

I'm trying to set the INT1 interrupt on movement, but it doesn't seem to be working.  I'm reading the acceleration data OK.  But when I shake the sensor, it's not waking up my microcontroller.  For comparison, I used someone else's code for an SPI implementation of the LIS3DH library, and using the EXACT same hardware, I'm able to set INT1 for movement interrupt and it wakes up my microcontroller.  But I need to use I2C because of other peripherals that I want to add.

 

Knowing that the hardware and wiring is OK, and knowing that the I2C code works as far as getting acceleration data, I've narrowed it down to the differences between how the I2C and SPI version is setting the INT1_CFG.

 

For reference, here's the SPI version that works for setting activity interrupt:

SPI version:  AA_LIS3DH_SPI - Debugging SPI LIS3DH | Mbed 

 

I'm setting this configuration in the I2C version:

 

INT1_CFG (0x30):  01111111;   //movement recognition, on all 3 axis.  I've also tried 00111111 (or combination of events)

INT1_THS (0x32):  00000010;  //threshold.  I've tried 0x01 too.

 

I'm doing a read of INT1_SRC to clear any interrupts.  I'm shaking the sensor to try to activate the interrupt.  Not getting anything with the I2C, but the SPI interrupts very reliably.

 

I've also try setting some values in INT1_DURATION, but no difference.

 

Am I missing anything else?

Outcomes