Skip to main content
Visitor II
March 27, 2018
Question

LSM6DS3 Data ready Interrupt

  • March 27, 2018
  • 2 replies
  • 1143 views
Posted on March 27, 2018 at 09:13

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:

1 Read STATUS

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.

0690X00000604SiQAI.jpg

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. 

#lsm6ds3 ##lsm6ds3-#fifo #lsm6ds3-interrupt
    This topic has been closed for replies.

    2 replies

    ST Employee
    March 29, 2018
    Posted on March 29, 2018 at 15:18

    You sensor configuration should be enough to make the accelerometer functional.

    I think there is something wrong with you data reading or I2C communication in general, because you read always 0.

    Are you able to read WHO_AM_I register?

    Visitor II
    April 4, 2018
    Posted on April 04, 2018 at 10:43

    Solved