2021-09-09 04:26 AM
Hi.
I'm working with LIS2DW12 and setting it to work in stationary/motion detection. The Wake-up interrupt is driven to INT1 pin. However, when observing the signal of INT1 with logic analyzer, when the sensor is moving, having acceleration higher than threshold, I can see that the INT1 pin goes to high state for a period of time longer than 1/ODR.
According to the application note AN5038, in activity/inactivity-stationary/motion detection mode, the WU_IA event (which is driven to INT1) should be automatically reset after an interval of 1/ODR.
I implement the code based on the provided example lis2dw12_activity.c by ST. Here is my code:
Initialization:
lis2dw12_device_id_get(&lis2dw12_dev, &whoamI);
lis2dw12_reset_set(&lis2dw12_dev, PROPERTY_ENABLE);
lis2dw12_block_data_update_set(&lis2dw12_dev, PROPERTY_ENABLE);
lis2dw12_int_notification_set(&lis2dw12_dev, LIS2DW12_INT_PULSED);
lis2dw12_data_rate_set(&lis2dw12_dev, LIS2DW12_XL_ODR_OFF);
Setting stationary/motion detection:
lis2dw12_full_scale_set(&lis2dw12_dev, LIS2DW12_2g);
lis2dw12_power_mode_set(&lis2dw12_dev,LIS2DW12_CONT_LOW_PWR_12bit);
lis2dw12_delay_ms(80);
lis2dw12_data_rate_set(&lis2dw12_dev,LIS2DW12_XL_ODR_12Hz5);
lis2dw12_filter_path_set(&lis2dw12_dev, LIS2DW12_HIGH_PASS_ON_OUT);
lis2dw12_wkup_dur_set(&lis2dw12_dev, 0);
lis2dw12_act_sleep_dur_set(&lis2dw12_dev, 0);
lis2dw12_wkup_threshold_set(&lis2dw12_dev, ths);
lis2dw12_act_mode_set(&lis2dw12_dev, LIS2DW12_DETECT_STAT_MOTION);
lis2dw12_pin_int1_route_get(&lis2dw12_dev, &int_route.ctrl4_int1_pad_ctrl);
int_route.ctrl4_int1_pad_ctrl.int1_wu = PROPERTY_ENABLE;
lis2dw12_pin_int1_route_set(&lis2dw12_dev, &int_route.ctrl4_int1_pad_ctrl);
lis2dw12_delay_ms(80);
2021-09-16 03:06 AM
Hi @KMa.1 ,
After how many time is the interrupt deasserted in your application? Less than 2*1/ODR?
You might try setting b01 in the WAKE_DUR field of the WAKE_UP_DUR register (instead of b00), and check if the interrupt high state is actually lasting 1/ODR
Note also that the SLEEP_ DUR default value b0000 is 16 * 1/ODR.
-Eleon
2021-10-04 06:23 AM
Hi, sorry for late response.
I tried setting 0b01 to WAKE_DUR. The issue still remains. The INT deasserted only when no motion (or motion below threshold) occurs. Figure below is the signal from the interrupt pin observed by logic analyzer with motion sensor configured as above.
2021-10-14 06:23 AM
Hi @KMa.1 ,
Did you have the possibility to test the code on another chip?
Can you also check if your interrupt is latched (LIR bit in CTRL3 (22h) register)? It looks as if the interrupt is latched (even if it doesn't appear from the code above).
-Eleon
2021-10-21 03:37 AM
Hi @KMa.1 ,
please let me know in case you do any progress.
-Eleon