2019-02-19 05:11 AM
Hi,
I am using STEVAL-MKII72V1 with LSM303AGR. I use TI CC2640R2F Launchpad to communicate to the LSM303AGR using I2C interface.
I have successfully generated LSM303AGR Interrupt 1 pin interrupt when activity threshold exceed 256 mg. I connect the LSM303AGR to a led on the TI CC2640R2F Launchpad. The led lights up whenever I move the LSM303AGR board.
But, I want to use the LSM303AGR Accelerometer activity/inactivity function, which will transition from Low Power Mode to Normal Mode. This functionality will reduce power consumption. The problem I am unable to generate a Interrupt 2 interrupt. Here is my initialization code below. The code below is a simplified version for sharing. What is the correct code initialization to enable LSM303AGR Accelerometer activity/inactivity function Interrupt 2.
// X, Y and Z-axis enable, power on mode, o/p data rate 10 Hz(0x27
LSM303AGR_CTRL_REG1_A |= 0x27;
// Full scale +/- 2g, continuous update(0x00)
LSM303AGR_CTRL_REG4_A |= 0x00;
// CTRL_REG6A(0x25H) P2_ACT Bit to 1
LSM303AGR_CTRL_REG6_A |= 0x08;
// INT2_CFG_A(0x34H) OR Combination of Interrupt Events
LSM303AGR_INT2_CFG_A |= 0x2A;
// 16 x 16mg = 256mg Threshold
LSM303AGR_Act_THS_A |= 0x0F;
// Set Activity Duration 1 LSb = (8*1[LSb]+1)/ODR
LSM303AGR_Act_DUR_A |= 0x07;
Regards,
Markel
2019-02-19 08:46 AM
Hi Markel, as regards to
// CTRL_REG6A(0x25H) P2_ACT Bit to 1
LSM303AGR_CTRL_REG6_A |= 0x08;
did you try to enable also I2_INT2 (int2 interrupt on int2 pad)?
// CTRL_REG6A(0x25H) P2_ACT Bit to 1
LSM303AGR_CTRL_REG6_A |= 0x28
Regards,
Eleon
2019-02-19 03:40 PM
Hi eleon.borlini.
I do not enable the I2_INT2 at LSM303AGR_CTRL_REG6_A. I follow the instruction as is base from the datasheet. After I enable the I2_INT2 at LSM303AGR_CTRL_REG6_A, it still does not work.
However after I set the values to LSM303AGR_INT2_CFG_A, LSM303AGR_INT2_THS_A, LSM303AGR_INT2_DURATION_A, now I see the Interrupt 2 working. But, I am not sure if that is the LSM303AGR ActivityInactivity functionality.
Regards,
Markel
2019-02-19 10:01 PM
Hi eleon.borlini,
Now the Interrupt 2 is working. When I move the LSM303AGR board I can see clearly the led turn on. But now the problem is when the LSM303AGR board is not moving, I see the led periodically turn on very quickly. This periodic interrupt is getting detected by TI CC2640R2F interrupt pin.
Regards,
Markel
2019-02-20 09:57 PM
Hi,
Can I get code to properly make the LSM303AGR activity/inactivity functionality work?
Regards,
Markel
2019-02-21 08:27 AM
Do you get the same behavior also if you latch the interrupt setting LIR_INT2 to 1 in reg CTRL_REG5_A (24h)?
2019-02-22 12:08 AM
Hi eleon.borlini,
I set the LIR_INT2 to 1 at CTRL_REG4_A(24h). I move the LSM303AGR and the led turn on constantly as expected. But, I do not want to set the LIR_INT2. I want to make the LSM303AGR activity/inactivity work according to what is mentioned in the datasheet. I do the exact instruction from the datasheet, section 4.2.3. But there is no Interrupt 2 happening. So, what is the code to properly make the LSM303AGR activity/inactivity work?
https://www.st.com/resource/en/datasheet/lsm303agr.pdf
Regards,
Markel
2019-02-26 10:15 PM
Hi,
It says in the datasheet this below. But if I do this the Interrupt 2 pin periodically goes to high according to the set ODR, even if there is no activity. Is this instruction right or wrong?
"Once the Activity/Inactivity detection function is enabled, it will be applied to the INT_2 pin by setting the CTRL_REG6_A (25h) (P2_ACT) bit to ‘1’."
Regards,
Markel
2020-11-03 08:57 AM
I can see definitely the led turn on. But now the problem is whilst the LSM303AGR board isn't always transferring, I see the led periodically turn on very quickly guide. This periodic interrupt is getting detected by way of TI CC2640R2F interrupt pin.