2018-02-18 10:51 PM
I want to use LIS2D for FIFO and tap interrupt. Its generating FIFO interrupt but I am not able to get single tap interrupt.My register settings are as below. I want my FIFO interrupt of INT1 and Tap interrupt on INT2. Please suggest where I am going wrong.
CTRL_REG1 : 0x37
CTRL_REG2 :
0x00
CTRL_REG3 :
0x04
CTRL_REG4 :
0x10
CTRL_REG5 :
0x40
CTRL_REG6 :
0xA0
CLICK_CFG : 0x15
Thanks.
2018-02-20 06:14 AM
I would suggest set the CTRL_REG6 to 0x80.
And you have to also set following registers for the single tap detection:
CLICK_THS (0x3A) ... 0x10
TIME_LIMIT (0x3B) ... 0x20
TIME_LATENCY (0x3C) ... 0x20
The values can be adjusted according to your needs.
2018-03-07 04:47 AM
Thanks Its working fine.
I have one doubt. If accelerator is on rest on a desk and it should give one axis value around 9.8 and other as zero. But I noticed one thing, If I am moving my accelerator to some other direction,its x , y and z values are changing and giving acceleration value (which is correct) but after going to new position later it should get back to one axis value as 9.8 and other axis around 0 but why this is not happening. Can you please suggest.
2018-03-07 06:18 AM
Previous position values are around these 3 values :
200,848,-448
192,856,-448200,840,-448Later I changed the position and make it rest in new position. I got below values :
16,96,-944
24,104,-936Note: Values are in milli G.
Thanks.
2018-03-07 06:48 AM
What are the values in the new position?
2018-03-07 09:02 AM
The value seems OK. I suppose the positions of the sensor are not exactly the same.
If you calculate the the absolute value of the acceleration (sqrt(X*X+Y*Y+Z*Z)) you will get 1g = 9.81m/s2 of gravity in all cases.
In the second position the Z axis is almost along the gravity vector.
2018-03-07 09:24 PM
Yes correct but I am asking something else. Let me try it again.
Accelerometer calculate acceleration. so if I am moving from a location to b location, After reaching new postion b, sensor should give acceleration value but after some time being on rest as there is no acceleration, X, Y and Z should get back to previous rest value but why this is not happening. I am confused right now. Please let me know if my understanding is correct.
Thanks
2018-03-10 08:20 AM
The X, Y, Z values in firts and second position will be the same only in case the postions of the sensor is absolutly the same (I mean the position towards to gravity vector).
2018-11-19 02:05 AM
Hi, I'm working on a similar program. Can you guide me as to which registers you are using to read the raw values. I tried using the OUT X, Y and Z registers but both interrupts aren't working well together.
This is my config:
write_i2c(I2C_DEVICE_ADDRESS, REG_CTRL1, 0x37); //power on all axis, max sample rate(400 Hz)
write_i2c(I2C_DEVICE_ADDRESS, REG_CTRL2, 0x00); //HPF disabled
write_i2c(I2C_DEVICE_ADDRESS, REG_CTRL3, 0x04); //Watermark (WTM) interrupt enabled on INT1 pin
write_i2c(I2C_DEVICE_ADDRESS, REG_CTRL4, 0x10); //Full Scale = ±4g
write_i2c(I2C_DEVICE_ADDRESS, REG_CTRL5, 0x40); //FIFO enabled
write_i2c(I2C_DEVICE_ADDRESS, REG_CTRL6, 0x80); //Click interrupt on INT2 pin
write_i2c(I2C_DEVICE_ADDRESS, REG_FIFO_CTRL, 0x9F); //FIFO Stream Mode selected ; (N+1) samples to be read at the rise of WTM interrupt
write_i2c(I2C_DEVICE_ADDRESS, REG_INT1_CFG, 0x3F); //Interrupt generation enabled on all axes for both high & low events
write_i2c(I2C_DEVICE_ADDRESS, REG_INT1_THS, 0x03); //1LSb = 32 mg
write_i2c(I2C_DEVICE_ADDRESS, REG_CLICK_CFG, 0x2A);
write_i2c(I2C_DEVICE_ADDRESS, REG_CLICK_THS, 0x02);
write_i2c(I2C_DEVICE_ADDRESS, REG_TIME_LIMIT, 0x10);
write_i2c(I2C_DEVICE_ADDRESS, REG_TIME_LATENCY, 0x40);
write_i2c(I2C_DEVICE_ADDRESS, REG_TIME_WINDOW, 0x90);
Regards
2018-11-19 04:29 AM
What you mean by "both interrupts aren't working well"? What is the behavior of your system?