01-19-2021 04:08 AM
Hi all,
I'm using BMI160 with an MCU. The MCU is able to receive interrupts such as step counter and any-motion.
However, I am not able to get LOW-G interrupt even though I adjusted parameters like low_dur & low_thres .
In another platform (a different MCu) with the same settings I can easily generate LOW-G interrupt.
My code is as follows.
Any feedback is appreciated.
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_data_src=BMI160_ENABLE;//
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 = acc_int.fd_fall_duration; // [ms] ((n+1) * 2.5) PREV=50
int_config.int_type_cfg.acc_low_g_int.low_thres = acc_int.fd_fall_threshold; // [mg] (n * 7.81) PREV=96
bmi160_set_int_config(&int_config, &vImec_gsensor); /* sensor is an instance of the structure bmi160_dev */
01-19-2021 06:35 AM
Hello ,
"In another platform (a different MCu) with the same settings I can easily generate LOW-G interrupt.", which MCU platform you could get interrupt? Which MCU platform you couldn't get interrupt?
If it is possible you could measure INT1 pin and check if sensor output HW interrupt signal.
01-19-2021 10:37 AM
Hi,
Ambiq micro (Apollo2) has no problem receiving interrupt. However Nordic 52840 never receives LOW-G interrupt.
01-20-2021 06:35 AM
Hello potter1234,
You could dump all BMI160 register value on Apollo2 and nrf52840 after SW initialization, and compare the difference. If Low-g related register values are same, you need to check nrf52840 driver and see how to enable receiving interrupt.
01-26-2021 03:16 AM
Hi,
After some more experiment I am able to receive low-g interrupt now. However, the interrupt bit I receives is always 0.
My code as follows.
union bmi160_int_status interrupt;
enum bmi160_int_status_sel int_status_sel;
/* Interrupt status selection to read all interrupts */
int_status_sel = BMI160_INT_STATUS_ALL;
int rslt = bmi160_get_int_status(int_status_sel, &interrupt, &sensor);
when I print out interrupt.bit, it always gives 0. Isn't that weird coz the table looks like this
struct bmi160_int_status_bits
{
#if LITTLE_ENDIAN == 1
uint32_t step : 1;
uint32_t sigmot : 1;
uint32_t anym : 1;
/* pmu trigger will be handled later */
uint32_t pmu_trigger_reserved : 1;
uint32_t d_tap : 1;
uint32_t s_tap : 1;
uint32_t orient : 1;
uint32_t flat_int : 1;
uint32_t reserved : 2;