I encountered a strange issue in BMI160 with nordic 52840 mcu. (on a customed board)
The situation looks like this:
1.The mcu has no problem receving irq like STEP_DETECT_INT, DOUBLE_TAP_INT, and the register values of 0x1C-0x1F are correctly displayed.
2. However, when I try to set irqs like LOW_G_INT, HiGH_G_INT, SLOW_NO_MOTION_INT, I can see irqs arriving in my interrupt handler, but the register values of 0x1C-0x1F are always zero.
This can be quite problematic, since I have no clue which interrups are triggered.
for setting low-g interrupt, my code looks like this
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_LOW_G_INT;// Choosing LOW G/fall detection 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 push-pull mode 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_NONE;// non-latched output
int_config.int_type_cfg.acc_low_g_int.low_en = BMI160_ENABLE;//
int_config.int_type_cfg.acc_low_g_int.low_mode = BMI160_ENABLE;//
int_config.int_type_cfg.acc_low_g_int.low_hyst = BMI160_ENABLE;//
int_config.int_type_cfg.acc_low_g_int.low_dur = low_dur; // [ms] ((n+1) * 2.5) PREV=50
int_config.int_type_cfg.acc_low_g_int.low_thres = low_thres; // [mg] (n * 7.81) PREV=96
bmi160_set_int_config(&int_config, &sensor); /* sensor is an instance of the structure bmi160_dev */
fall_detected = false;
I'm pretty sure I followed every guideline from here https://github.com/BoschSensortec/BMI160_driver
What could possibly be wrong here? Is it possible that it has something to do with HW schematic?
Any feedback will be appreciated.
There was another ticket that had same TAP feature usage with you.
You could refer this ticket.
What I've been struggling has nothing to do with tap at all.
My question is I can see LOW_G_INT, HiGH_G_INT, SLOW_NO_MOTION_INT, irqs firing, but the register values of 0x1C-0x1F are always zero.
In this case, I can't tell which interrupt is actually firing and I really need to distinguish them.
It was a reference code that run well. When MCU received HW interrupt signal, then read non-zero 0x1C-0x1F register values. For your reference to compare with you code.