03-08-2021 02:26 AM
Dear
I am trying to see the tap interrupt(Single and Double). It seems that it doesn't work properly even single tap detection.
Please, review what I enabled and configured the registers for tap sensing. The file attached.
Thanks,
Solved! Go to Solution.
03-08-2021 03:42 AM
Hello Gideon,
TAP feature needed high ODR, you could set ODR to 200 Hz and test it again.
03-08-2021 06:14 AM
Thanks for your help.
Could you let me get the best configuration values for double tap?
Here are settings that I evaluated but it is hard to see double tap interrupt.
Sometimes, the double tap interrupt occurs but not every time.
int_config.int_channel = BMI160_INT_CHANNEL_2;// Interrupt channel/pin 1
int_config.int_type = BMI160_ACC_DOUBLE_TAP_INT;// Choosing Any motion interrupt
/* Select the interrupt channel/pin settings */
int_config.int_pin_settg.output_en = BMI160_ENABLE;// Enabling interrupt pins to act as output pin
int_config.int_pin_settg.output_mode = BMI160_DISABLE;// Choosing Open drain for interrupt pin
int_config.int_pin_settg.output_type = BMI160_DISABLE;// Choosing active low output
int_config.int_pin_settg.edge_ctrl = BMI160_ENABLE;// Choosing edge triggered output
int_config.int_pin_settg.input_en = BMI160_DISABLE;// Disabling interrupt pin to act as input
// int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_80_MILLI_SEC;// non-latched output
// int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_160_MILLI_SEC;
int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_10_MILLI_SEC;
// Configure accel and gyro sensors in normal mode
sensor.accel_cfg.odr = BMI160_ACCEL_ODR_200HZ;
sensor.accel_cfg.range = BMI160_ACCEL_RANGE_2G;
sensor.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4;
sensor.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE;
sensor.gyro_cfg.odr = BMI160_GYRO_ODR_50HZ;
sensor.gyro_cfg.range = BMI160_GYRO_RANGE_125_DPS;
sensor.gyro_cfg.bw = BMI160_GYRO_BW_NORMAL_MODE;
sensor.gyro_cfg.power = BMI160_GYRO_SUSPEND_MODE;
/* Set the Power mode */
rslt = bmi160_set_power_mode(&sensor);
/* Select the Any-motion interrupt parameters */
int_config.int_type_cfg.acc_tap_int.tap_thr = 4; // 62.5mg * val for 2g
// 125mg * val for 4g
int_config.int_type_cfg.acc_tap_int.tap_shock = BMI160_DISABLE; // 0 : 50ms / 1 : 75ms
int_config.int_type_cfg.acc_tap_int.tap_quiet = BMI160_DISABLE; // 0 : 30ms / 1 : 20ms
int_config.int_type_cfg.acc_tap_int.tap_data_src=BMI160_DISABLE; // filtered or pre-filtered
int_config.int_type_cfg.acc_tap_int.tap_dur = 3; //0:50ms, 1:100ms, 2:150ms, 3:200ms, 4:250ms....
int_config.int_type_cfg.acc_tap_int.tap_en = BMI160_ENABLE;
04-02-2021 04:02 AM
Hello Gideon,
Here is BMI160 double TAP code for your reference.
int8_t rslt = BMI160_OK;
struct bmi160_int_settg int_config;
/* Select the Interrupt channel/pin */
int_config.int_channel = BMI160_INT_CHANNEL_1;// Interrupt channel/pin 1
/* Select the Interrupt type */
int_config.int_type = BMI160_ACC_DOUBLE_TAP_INT;
/* Select the interrupt channel/pin settings */
int_config.int_pin_settg.output_en = BMI160_ENABLE;// Enabling interrupt pins to act as output pin
int_config.int_pin_settg.output_mode = BMI160_DISABLE;// Choosing push-pull mode for interrupt pin
int_config.int_pin_settg.output_type = BMI160_ENABLE;// Choosing active high output
int_config.int_pin_settg.edge_ctrl = BMI160_DISABLE;// Choosing edge triggered output
int_config.int_pin_settg.input_en = BMI160_DISABLE;// Disabling interrupt pin to act as input
int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_80_MILLI_SEC;// latched output
/* Select the Flat interrupt parameters */
int_config.int_type_cfg.acc_tap_int.tap_en = BMI160_ENABLE;//tap enable, 1 - enable, 0 - disable
int_config.int_type_cfg.acc_tap_int.tap_data_src=BMI160_ENABLE;//data source 0- filter & 1 pre-filter
/*tap duration, select the length of the time window for the second shock event for double tap detection,
000 - 50ms, 001 - 100ms, 010 - 150ms, 011 - 200ms, 100 - 250ms, 101 - 375ms, 110 - 500ms, 111 - 700ms*/
int_config.int_type_cfg.acc_tap_int.tap_dur = 2;
int_config.int_type_cfg.acc_tap_int.tap_quiet = BMI160_DISABLE;//tap quiet, 0 - 30ms, 1 - 20ms
int_config.int_type_cfg.acc_tap_int.tap_shock = BMI160_DISABLE;//tap shock duration, 0 - 50ms, 1 - 75ms
int_config.int_type_cfg.acc_tap_int.tap_thr = 2;//tap threshold
/* Set the Flat interrupt */
rslt = bmi160_set_int_config(&int_config, dev); /* sensor is an instance of the structure bmi160_dev */
04-06-2021 06:02 AM
Thanks a lot.