Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 Flat Detect

    BMI270 Flat Detect

    New Poster



    I migrated my application from BMI160 to BMI270 and I am having a few issues. Flat detect interrupt for example is not working as in BMI160. It used to trigger only when the gravity is on the z-axis. On BMI270, it's triggering in all orientation. 

    I tried to play with the settings but I can't get the behaviour I want. 

    Can you please help me understand how to configure this feature on the BMI270?


    Thank you


    10 REPLIES 10

    Community Moderator
    Community Moderator

    Hello Katie2020,

    Did you use BMI270 github software( or other software version?



    Yes I am using the code from GitHub



    Hi Bsoch Sensortec Community

    I've done more testing/invetigation today and I found the following:

    • BMI270 is only triggering interrupt if TAP is enabled. This means if I enable FLAT only, this won't work - I need to enable TAP as well to make it work. See below my code. Is this an intented behaviour?
    struct bmi2_sens_int_config sens_int = {.type = BMI2_FLAT, .hw_int_pin = BMI2_INT1};
        /* Get default configurations for the type of feature selected. */
        struct bmi2_sens_config config;
        config.type = BMI2_FLAT;
        config.cfg.flat.hold_time = 1;
        config.cfg.flat.theta = 0x33;
        config.cfg.flat.hysteresis = 1;
        config.cfg.flat.blocking = 0;
        rslt = bmi270_legacy_set_sensor_config(&config, 1, &ss_sens);
        rslt = bmi270_legacy_get_sensor_config(&config, 1, &ss_sens);
        rslt = bmi270_legacy_map_feat_int(&sens_int, 1, &ss_sens);
    • In the interrupt status, only TAP is reported - see my code below. Is this an intented behaviour?
    uint16_t int_status;
    int8_t rslt;
    rslt = bmi2_get_int_status(&int_status, &ss_sens);  // int_status is always equal to 8 

    Am I missing something? With BMI160, I can enable one interrupt at the time with no issue. Also interrupt status reports the correct interrupt using:

    bmi160_get_int_status(BMI160_INT_STATUS_ALL, &int_status, &ss_sens);

    Can't we get all interrupts status on BMI270 at all?

    Thank you

    Community Moderator
    Community Moderator

    Hello Katie2020,

    Did you have interrupt pin connected to host MCU on your hardware board?
    If you have, you could modify the code to read the sensor status register in the interrupt mode. After receiving the interrupt signal, read the value of the interrupt status register to see if it is correct value?