2022-04-15 04:53 AM
Hello!
Our application uses accelerometer in three modes:
Here is power down mode configuration:
lis2dw12_data_rate_set(&handle.acc_dev, LIS2DW12_XL_ODR_OFF);
Motion detection configuration:
accel_soft_reset();
/*Configure accelerometer for monitor motion mode*/
lis2dw12_full_scale_set(&handle.acc_dev, LIS2DW12_2g);
lis2dw12_data_rate_set(&handle.acc_dev, LIS2DW12_XL_ODR_25Hz));
lis2dw12_power_mode_set(&handle.acc_dev, LIS2DW12_CONT_LOW_PWR_LOW_NOISE_12bit);
lis2dw12_filter_path_set(&handle.acc_dev, LIS2DW12_HIGH_PASS_ON_OUT);
lis2dw12_wkup_dur_set(&handle.acc_dev, 0);
lis2dw12_wkup_threshold_set(&handle.acc_dev, handle.settings.motion_thld);
/*Enable interrupt generation in INT1*/
lis2dw12_pin_int1_route_get(&handle.acc_dev, &int_route.ctrl4_int1_pad_ctrl);
int_route.ctrl4_int1_pad_ctrl.int1_wu = PROPERTY_ENABLE;
lis2dw12_pin_int1_route_set(&handle.acc_dev, &int_route.ctrl4_int1_pad_ctrl);
Tilt angle configuration:
lis2dw12_reg_t int_route;
/*Soft reset to restore configuration*/
accel_soft_reset();
/*Enable block data update to prevent corrupted fifo data*/
lis2dw12_block_data_update_set(&handle.acc_dev, PROPERTY_ENABLE);
lis2dw12_full_scale_set(&handle.acc_dev, LIS2DW12_2g);
lis2dw12_data_rate_set(&handle.acc_dev, LIS2DW12_XL_ODR_25Hz);
/*Configure FIFO*/
lis2dw12_fifo_watermark_set(&handle.acc_dev, 20);
lis2dw12_fifo_mode_set(&handle.acc_dev, LIS2DW12_STREAM_MODE);
/*Enable interrupt on fifo watermark*/
lis2dw12_pin_int1_route_get(&handle.acc_dev, &int_route.ctrl4_int1_pad_ctrl);
int_route.ctrl4_int1_pad_ctrl.int1_fth = PROPERTY_ENABLE;
lis2dw12_pin_int1_route_set(&handle.acc_dev, &int_route.ctrl4_int1_pad_ctrl);
And wake up interrupt handling code:
lis2dw12_all_sources_t all_source;
/*Get interrupt sources*/
lis2dw12_all_sources_get(&handle.acc_dev, &all_source);
if (all_source.wake_up_src.wu_ia) {
/*Interrupt because of wakeup*/
DRV_ACC_motion_status_t motion_status =
DRV_ACC_MOTION_STATUS_MOTION_DETECTED;
xQueueSend(handle.motion_detection_queue, &motion_status, portMAX_DELAY);
}
Application logic is:
It works fine only for the first motion detection.
After the second iteration wake up interrupt is generated when going from the power down mode to the wake up detection mode. Accelerometer is not moved.
I have checked wake up source registers, value of the register is always the same as in the first iteration. How is it possible to reset wake up source?
Expected behavior: No interrupts on the power down to the monitor detection transmission.
Actual behavior: Accelerometer generates wake up interrupt even if there was no motion.