dajtxx But the above readings are with the board sitting on my desk. So does -9.8… equate to 1g?
The measurements are in m/s2. 1g = 9.80665 m/s2
And why are there non-zero values on x & Y when the board is not moving? Do I need to put some code in to add offsets for manufacturing or something?
XY are never going to be perfect zero. They could be offset by a small amount in either the positive or negative direction.
To get the sample working I had to enable floating point support on the MCU and use newlib so the double values could be printed out. I also changed the setup of the sensor using guiconfig to have no trigger so it’s being polled by the code because I was getting constant reboots with the trigger enabled.
Yea, I’m aware of this, turns out the driver was changed along the way and now requires two pins to be defined for interrupts (even if there’s only one connected!) I opened up a ticket on the Zephyr repolast week: https://github.com/zephyrproject-rtos/zephyr/issues/34794
Easiest solution for now is to pick another pin that you’re not using as the INT2 pin in your .overlay file.
&i2c1 {
lis2dh@18 {
compatible = "st,lis2dh";
label = "LIS2DH";
reg = <0x18>;
irq-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>, <&gpio0 30 GPIO_ACTIVE_HIGH>;
};
};