AnsweredAssumed Answered

LSM6DS3 Data ready Interrupt

Question asked by Yaroslav Kirillov on Mar 27, 2018
Latest reply on Apr 4, 2018 by Yaroslav Kirillov

Hi, I`m facing a problem to get data ready interrupt on INT1.

Use I2C communication.

Trying to make fifo work and stuck with that, so started from data ready. 

According to Application notes :

1 Write CTRL9_XL = 38h // Acc X, Y, Z axes enabled
2 Write CTRL1_XL = 60h // Acc = 416Hz (High-Performance mode)
3 Write INT1_CTRL = 01h // Acc Data Ready interrupt on INT1

Initialize 3 registers and try to read data in interrupt from INT1 according to chapter 4.2 in application notes.

If i read STATUS_REG in interrupt then i stuck inside HAL_I2C_Mem_Read function in busy state. 

If I read it in my main while(1) then it start working, but interrupt generated in a strange way (picture attached.)

I read:

2 If XLDA = 0, then go to 1
3 Read OUTX_L_XL
4 Read OUTX_H_XL
5 Read OUTY_L_XL
6 Read OUTY_H_XL
7 Read OUTZ_L_XL
8 Read OUTZ_H_XL

I toggle output pin in my interrupt.


When i read STATUS_REG i see that the first bit is 1, which mean acc data is ready.

But no matter when i read it it is always 1. I read it when interrupt take a place and it is 1. I read it again after reading out from OUTX_L_XL, OUTX_H_XL, OUTY_L_XL, OUTY_H_XL, OUTZ_L_XL, OUTZ_H_XL it is still one. Data that i read from output registers is always 0.

I change my acc to be 104 hz. Same picture.

If i don`t read Status_reg than i don`t see any interrupts coming.

So first problem is to read data inside interrupt callback. (but i can read it in main). Stuck in I2C, i cannot explain what the difference when i trying to read i2C inside interrupt or outside.

Second why interrupts are coming in different timing and data is always 0.


ps: I can retrieve data from acc if my INT_1 = 0, and i read from OUTX_L_XL.