Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 gyroscope always zero immediately after initialisation

    BMI270 gyroscope always zero immediately after initialisation

    Established Member

    The first few gyroscope samples immediately after initialisation are always zero.  The corresponding accelerometer samples are of expected values.  Both the gyroscope and accelerometer are configured for the same ODR.  Data is read each time the data-ready interrupt is asserted.

    This behaviour suggests that the gyroscope and accelerometer are not synchronised.  Please can someone clarify what is going on.

    The number of consecutive gyroscope samples equal to zero immediately after initialisation is constant for each ODR as summarised in the table below.  These values are not affected by gyr.filter_perf or gyr.noise_perf.

    ODR (same for gyro and accel)Number of gyro zero samplesCalculated period (ms)


    Here is the initialisation code for reference:

        // Initialise device
        if (bmi270_init(&bmi270) != BMI2_OK) {
            initialisationFailed = true;
        // Perform soft reset
        bmi2_set_adv_power_save(BMI2_DISABLE, &bmi270);
        // Enable accelerometer and gyroscope
        const uint8_t sensorList[] = {BMI2_ACCEL, BMI2_GYRO};
        bmi2_sensor_enable(sensorList, 2, &bmi270);
        // Configure accelerometer
        struct bmi2_sens_config accelerometerConfig = {
            .type = BMI2_ACCEL,
            .cfg.acc.odr = BMI2_ACC_ODR_400HZ,
            .cfg.acc.bwp = BMI2_ACC_NORMAL_AVG4,
            .cfg.acc.filter_perf = 1,
            .cfg.acc.range = BMI2_ACC_RANGE_16G,
        bmi2_set_sensor_config(&accelerometerConfig, 1, &bmi270);
        // Configure gyroscope
        struct bmi2_sens_config gyroscopeConfig = {
            .type = BMI2_GYRO,
            .cfg.gyr.odr = BMI2_GYR_ODR_400HZ,
            .cfg.gyr.bwp = BMI2_GYR_NORMAL_MODE,
            .cfg.gyr.filter_perf = 1,
            .cfg.gyr.ois_range = BMI2_GYR_OIS_2000,
            .cfg.gyr.range = BMI2_GYR_RANGE_2000,
            .cfg.gyr.noise_perf = 1,
        bmi2_set_sensor_config(&gyroscopeConfig, 1, &bmi270);
        // Configure data ready interrupt on INT1 pin
        struct bmi2_int_pin_config intPinConfig = {
            .pin_type = BMI2_INT1,
            .int_latch = BMI2_INT_NON_LATCH,
            .pin_cfg[0].lvl = BMI2_INT_ACTIVE_HIGH,
            .pin_cfg[0].od = BMI2_INT_PUSH_PULL,
            .pin_cfg[0].output_en = BMI2_INT_OUTPUT_ENABLE,
            .pin_cfg[0].input_en = BMI2_INT_INPUT_DISABLE,
        bmi2_set_int_pin_config(&intPinConfig, &bmi270);
        bmi2_map_data_int(BMI2_DRDY_INT, BMI2_INT1, &bmi270);


    2 REPLIES 2

    Occasional Contributor

    This is an expected behavior.

    After sensor initialization, both accelerometer and gyroscope are in suspend mode by default.

    The startup time it takes the accelerometer to start from suspend mode to normal mode is different from the time it takes the gyroscope. The gyroscope is slower than the accelerometer.

    In other words, they are not synchronized at the beginning. But once the gyroscope starts up, they will be synchronized.

    Hi sebmadgwick,

    could you insert a call to bmi2_get_int_status or bmi2_get_status in your interrupt service routine ?

    BMI270 has 3 data ready sources (auxiliary, gyro and accel), but a unified data ready interrupt. If you have more than 1 sensor enabled (especially at different rates), you can read the status to determine the source of the interrupt.

    Synchronicity is guaranteed by design, the sampling of accelerometer, gyroscope and internal temperature sensor is aligned with the updates to the SENSORTIME register. For example, when sampling at 100 Hertz, bits 23..8 will of the SENSORTIME register will become a sample counter, and bit 7..0 indicate the age of the sample.