Has anyone had success getting triggers on motion to work with the LIS2DH? I only have INT1 wired so I modified the drivers to work on INT1 as the spec document says it should. I've added the appropriate registers: to list2dh.h:
Has anyone had success getting triggers on motion to work with the LIS2DH? I only have INT1 wired so I modified the drivers to work on INT1 as the spec document says it should. I've added the appropriate registers: to list2dh.h:
Hello,
Have you also configured these pins in your overlay? Do you get an error message or does it not communicate with the device correctly? Have a look at my colleague Simon's answer here, note that it was for NCS tag 1.3.1.
Kind regards,
Øyvind
Hello,
Have you also configured these pins in your overlay? Do you get an error message or does it not communicate with the device correctly? Have a look at my colleague Simon's answer here, note that it was for NCS tag 1.3.1.
Kind regards,
Øyvind
INT1 is in the overlay:
lis2dh@18 {
compatible = "st,lis2dh";
reg = <0x18>;
irq-gpios = <&gpio0 12 0>; // GPIO_ACTIVE_HIGH>;
label = "LIS2DH";
};
It does trigger for SENSOR_TRIG_DATA_READY and that works fine. Trying to get it to trigger on movement.
Also, how do you add the send interrupt to the irq-gpios line?
NautDesigner said:It does trigger for SENSOR_TRIG_DATA_READY and that works fine. Trying to get it to trigger on movement.
Have you configured INT1 to movement recognition? As LIS2DH datasheet, page 39, states:
"AOI-6D = ‘01’ is movement recognition. An interrupt is generate when orientation move from unknown zone to known zone. The interrupt signal stay for a duration ODR."
From sensor.h, SENSOR_TRIG_DATA_READY states:
/** Trigger fires whenever new data is ready. */
What I am finding is that if I just setup the trigger, nothing happens. However, if I call fetch_and_display(sensor) before going into a wait loop, the trigger does fire. But then it never stops firing.
This is the output:
Sampling at 10 Hz
[00:00:00.024,780] [0m<inf> lis2dh: slope_config
[00:00:00.030,334] [0m<inf> lis2dh: int1_ths=0x49 range_g=16 ums2=89999999
[00:00:00.038,146] [0m<inf> lis2dh: slope_config
[00:00:00.043,182] [0m<inf> lis2dh: int1_dur=0x4
[00:00:00.048,614] [0m<inf> lis2dh: trigger_set
[00:00:00.053,558] [0m<inf> lis2dh: trigger_anym_set
[00:00:00.058,959] [0m<inf> lis2dh: setup_int1
[00:00:00.064,697] [0m<inf> lis2dh: start_trigger_int1
[00:00:00.070,281] [0m<inf> lis2dh: setup_int1
Waiting for triggers
#1 @ 78 ms: , x 3.22 , y 99.29 , z 64.36, g 108.6
MOTION - #2 @ 117 ms: , x 0.00 , y 8.27 , z 5.06, g 0.1
MOTION - #3 @ 215 ms: , x 0.00 , y 8.27 , z 5.06, g 0.1
MOTION - #4 @ 312 ms: , x -0.46 , y 7.35 , z 5.52, g 0.6
MOTION - #5 @ 409 ms: , x 0.00 , y 8.27 , z 5.06, g 0.1
MOTION - #6 @ 507 ms: , x -0.46 , y 7.81 , z 5.06, g 0.5
MOTION - #7 @ 604 ms: , x 0.46 , y 7.35 , z 5.52, g 0.6
MOTION - #8 @ 701 ms: , x 0.00 , y 7.35 , z 5.52, g 0.6
MOTION - #9 @ 799 ms: , x 0.00 , y 7.81 , z 4.60, g 0.7
MOTION - #10 @ 896 ms: , x -0.46 , y 8.27 , z 5.52, g 0.2
MOTION - #11 @ 993 ms: , x 0.00 , y 7.81 , z 5.52, g 0.2
I do have the movement specified:
I need to ask, but have you looked at the LIS2DH sample?
https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.99-ncs-branch/drivers/sensor/lis2dh/lis2dh.c
If this does not help, then I would suggest asking the Zephyr forum. See Asking for help in the Zephyr docs
Kind regards,
Øyvind
Yes, I have. I'm modifying the drivers and using the sample. I'll ask over at Zephyr. Thanks.