02-29-2024 03:29 PM
I am using a BMI270 connected to an ESP32-S3 with I2C on a custom board. INT1 of the BMI270 is connected to IO8 on the ESP32.
I'm initializing the BMI270 with the config file from https://github.com/boschsensortec/BMI270_SensorAPI/blob/master/bmi270.c
I'm reading init_ok from INTERNAL_STATUS register (0x21) after initialization.
Next I configure the accelerometer and gyroscope to 100Hz data rate and enable the interrupt:
//Enable accelerometer, gyroscope, and temperature sensors, disable aux interface
i2c_write_register(I2C_NUM_1, BMI270_ADDR, 0x7D, 0x0E);
i2c_write_register(I2C_NUM_1, BMI270_ADDR, 0x40, 0xA8);
i2c_write_register(I2C_NUM_1, BMI270_ADDR, 0x42, 0xA8);
i2c_write_register(I2C_NUM_1, BMI270_ADDR, 0x7C, 0x02);
//Enable INT1 interrupt pin, map to data ready interrupt
i2c_write_register(I2C_NUM_1, BMI270_ADDR, 0x53, 0x0C);
i2c_write_register(I2C_NUM_1, BMI270_ADDR, 0x58, 0x04);
When I read the accelerometer and gyroscope data once a second it seems to be correct when I move the board around.
Reading the INT_STATUS_1 register, bit 6 & 7, gyroscope & accelerometer data ready interrupt bits are 1.
However, I'm not getting any change on the INT1 pin. The ESP32 pin is configured as an input and when I enable the internal pull-up INT1 is high. When I disable the pull-up the pin is low, indicating that the BMI270 is not driving the INT1 pin.
Any idea what I am doing wrong here? Any suggestions are greatly appreciated.
Thanks.
03-04-2024 10:19 AM
Hi Dutch2,
What feature(any motion, data ready, etc.) do you expect to use for BMI270 and output it to INT1?
03-04-2024 03:02 PM
Right now I'm trying to get a Data Ready Interrupt.
My ultimate goal is to feed the accelerometer and gyroscope data into a Kalman filter to get tilt information.
Thanks.
03-07-2024 06:42 AM
Hi Dutch2,
https://github.com/boschsensortec/BMI270_SensorAPI/blob/master/bmi270_examples/accel_gyro/accel_gyro... has demonstrated the data ready interrupt for reading sensor data.
You can refer to this example code and add the following code in set_accel_gyro_config() function.
struct bmi2_int_pin_config int_cfg;
bmi2_get_int_pin_config(&int_cfg, dev);
int_cfg.pin_type = BMI2_INT1;
int_cfg.pin_cfg[0].lvl = BMI2_INT_ACTIVE_HIGH;/*Config INT1 rising edge trigging*/
int_cfg.pin_cfg[0].od = BMI2_INT_PUSH_PULL;
int_cfg.pin_cfg[0].output_en= BMI2_INT_OUTPUT_ENABLE;
bmi2_set_int_pin_config(&int_cfg, dev);
bmi2_error_codes_print_result(rslt);
Also ensure that your host IO is configured with interrupt mode and the correct triggering method.