2018-03-27 12:13 AM
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 INT1Initialize 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 13 Read OUTX_L_XL4 Read OUTX_H_XL5 Read OUTY_L_XL6 Read OUTY_H_XL7 Read OUTZ_L_XL8 Read OUTZ_H_XLI 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.
#lsm6ds3 ##lsm6ds3-#fifo #lsm6ds3-interrupt2018-03-29 06:18 AM
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?
2018-04-04 01:43 AM
Solved