Hi! I want to use the MMA8652 accelerometer to automatically trigger a motion detection interrupt in order to wake up the iMX6ULL.
I’ve configured the device tree as follows:
&i2c1 {
...
// http://git.toradex.com/cgit/linux-toradex.git/tree/Documentation/devicetree/bindings/iio/accel/mma8452.txt?h=toradex_5.4-2.3.x-imx
mma8652fc@1d {
compatible = "fsl,mma8652";
reg = <0x1d>;
interrupt-parent = <&gpio4>;
interrupts = <16 0>;
interrupt-names = "INT1";
status = "okay";
};
};
And I can access the device in /sys/bus/iio/devices/iio\:device0
. I have enabled motion detection interrupts as follows:
echo 15 > events/in_accel_mag_rising_value
echo 1 > events/in_accel_mag_rising_period
echo 1 > events/in_accel_x_mag_rising_en
echo 1 > events/in_accel_y_mag_rising_en
echo 1 > events/in_accel_z_mag_rising_en
And I can see the interrupt source for the accelerometer using cat /proc/interrupts
.
My question is how can I get access to this interrupt or event from user space in order to see if it actually triggers the interrupt? (I’ve tried cat /dev/iio\:device0
but it is always empty) Also, how can I configure the device tree to use the interrupt GPIO (INT1) as a wakeup source?
Any help would be appreciated. If someone has done something similar with other accelerometers or sensors in general, please provide advice.
Colibri iMX6ULL 512MB WB IT
Custom carrier board
Linux TDX X11 5.2.0-devel-20210226152038+build.0 (dunfell)