Hi o_o I added a function to print out the BMX160's registers, 1sec after init completed. This helped me to debug. I added bmi160_set_int_config just after the TAP config. This did help, but on its own did not solve my problem. What I found to be the final crucial step is the order of bmi160_set_int_config,bmi160_set_sens_conf and bmi160_set_power_mode. (I couldn't find where the GitHub README is clear on this). I originally had the order as follows (without bmi160_set_power_mode) - NOT WORKING: bmi160_init bmi160_set_sens_conf bmi160_set_int_config The registers were set correctly when I added (bmi160_set_power_mode) and set the order as follows - WORKING: bmi160_init bmi160_set_int_config bmi160_set_sens_conf bmi160_set_power_mode For those who need a guide, here is what my init code looks like: struct bmi160_dev bmi;
// --------------- Init BMX160 ---------------------
bmi.id = BMI160_I2C_ADDR;
bmi.interface = BMI160_I2C_INTF;
bmi.read = I2C_0_readDataBlock;
bmi.write = performDimWrite;
bmi.delay_ms = delay_miliSec;
bmm.dev_id = BMM150_DEFAULT_I2C_ADDRESS;
bmm.intf = BMM150_I2C_INTF;
bmm.read = bmm150_aux_read;
bmm.write = bmm150_aux_write;
bmm.delay_ms = delay_miliSec;
rslt_ = bmi160_init(&bmi);
printf("bmi160_init:%i\r\n", rslt_);
// --------------- Acc & Gryo ---------------------
// Configure accel and gyro sensors in normal mode
bmi.accel_cfg.odr = BMI160_ACCEL_ODR_50HZ;
bmi.accel_cfg.range = BMI160_ACCEL_RANGE_4G;
bmi.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4;
bmi.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE;
bmi.gyro_cfg.odr = BMI160_GYRO_ODR_50HZ;
bmi.gyro_cfg.range = BMI160_GYRO_RANGE_125_DPS;
bmi.gyro_cfg.bw = BMI160_GYRO_BW_NORMAL_MODE;
bmi.gyro_cfg.power = BMI160_GYRO_SUSPEND_MODE;
struct bmi160_int_settg bmi_int_config;
// Configure sensor interrupt (Data Ready)
printf("Init:DataReady\r\n");
/* Select the Interrupt channel/pin */
bmi_int_config.int_channel = BMI160_INT_CHANNEL_1;// Interrupt channel/pin 1
/* Select the interrupt channel/pin settings */
bmi_int_config.int_pin_settg.output_en = BMI160_ENABLE;// Enabling interrupt pins to act as output pin
bmi_int_config.int_pin_settg.output_mode = BMI160_DISABLE;// Choosing push-pull mode for interrupt pin
bmi_int_config.int_pin_settg.output_type = BMI160_ENABLE;// Choosing active High output
bmi_int_config.int_pin_settg.edge_ctrl = BMI160_ENABLE;// Choosing level triggered output
bmi_int_config.int_pin_settg.input_en = BMI160_DISABLE;// Disabling interrupt pin to act as input
bmi_int_config.int_pin_settg.latch_dur =BMI160_LATCH_DUR_NONE;// non-latched output
/* Select the Interrupt type */
bmi_int_config.int_type = BMI160_ACC_GYRO_DATA_RDY_INT;// Choosing Data Ready interrupt
/* Set the Data Ready interrupt */
rslt_ = bmi160_set_int_config(&bmi_int_config, &bmi); /* sensor is an instance of the structure bmi160_dev */
printf("bmi160_set_int_config:%i\r\n", rslt_);
// Configure sensor interrupt (Tap)
printf("Init:Tap\r\n");
/* Select the Interrupt channel/pin */
bmi_int_config.int_channel = BMI160_INT_CHANNEL_2;// Interrupt channel/pin 2
/* Select the interrupt channel/pin settings */
bmi_int_config.int_pin_settg.output_en = BMI160_ENABLE;// Enabling interrupt pins to act as output pin
bmi_int_config.int_pin_settg.output_mode = BMI160_DISABLE;// Choosing push-pull mode for interrupt pin
bmi_int_config.int_pin_settg.output_type = BMI160_ENABLE;// Choosing active High output
bmi_int_config.int_pin_settg.edge_ctrl = BMI160_ENABLE;// Choosing level triggered output
bmi_int_config.int_pin_settg.input_en = BMI160_DISABLE;// Disabling interrupt pin to act as input
bmi_int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_NONE;// non-latched output
/* Select the Interrupt type: Tap */
bmi_int_config.int_type = BMI160_ACC_SINGLE_TAP_INT;// Choosing Step Detector interrupt
/* Select the Step Detector interrupt parameters, Kindly use the recommended settings for step detector */
bmi_int_config.int_type_cfg.acc_tap_int.tap_en = BMI160_ENABLE;// 1-enable, 0-disable the detector
bmi_int_config.int_type_cfg.acc_tap_int.tap_data_src=BMI160_ENABLE; // use pre-filter
// bmi_int_config.int_type_cfg.acc_tap_int.tap_dur = 1; // not applicable to single tap
bmi_int_config.int_type_cfg.acc_tap_int.tap_quiet = BMI160_DISABLE; // 30/20ms
bmi_int_config.int_type_cfg.acc_tap_int.tap_shock = BMI160_DISABLE; // 50/75ms
bmi_int_config.int_type_cfg.acc_tap_int.tap_thr = 0b00001; // 125mg/2 = 62.5mg per bit (4g range)
/* Set the Tap Detector interrupt */
rslt_ = bmi160_set_int_config(&bmi_int_config, &bmi); /* sensor is an instance of the structure bmi160_dev */
printf("bmi160_set_int_config:%i\r\n", rslt_);
/* Set the sensor configuration */
rslt_ = bmi160_set_sens_conf(&bmi);
printf("bmi160_set_sens_conf:%i\r\n", rslt_);
/* Set the Power mode */
rslt_ = bmi160_set_power_mode(&bmi);
printf("bmi160_set_power_mode:%i\r\n", rslt_); Thanks for the help o_o
... View more