Hi, I'm trying to use the accelerometer sensor LIS2DH12, and having some issues reading data from it. Sometimes it works fine, but when re-flashing the device it doesn't work. I try to power-cycle but still issue with it. The values are all '0'
..
..
Got it to work now!
Think it might have been the magnetometer (LIS2MDL) connected to the same SPI-bus that was sending out some garbage. Saw that when CS is high the sensors are configured for I2C.
When I configured the magnetometer sensor in my device tree and enabled the LIS2MDL driver in Zephyr OS it is working fine.
But I have another question regarding the accelerometer LIS2DH12.
I'm trying to configure the interrupt, to trigger when e.g. the x-axis goes above a threshold value. Not sure what to put in the INT1_THS register?
and, in the output registers (OUT_X_L and OUT_X_H) what's the value/unit? is it in g, mg or m/s2?
Looked in the datasheet and looks like when the sensor is configured in Normal Mode with +-2g sensitivity, each digit is equal to 4mg?
So if I read out for example the raw value '2000' from x-axis, this should be:
2000x4 = 8000mg = 8g?
How can it be 8g when the measurement range is +-2g?
The reason I'm asking is because I'm trying to get the interrupt to work. It is working but not as expected. Either the interrupt never triggers, or it triggers priodically, even when the device is not moving.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.