Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 Flat Detect

    BMI270 Flat Detect

    Katie2020
    New Poster

    Hi,

     

    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

    BSTRobin
    Community Moderator
    Community Moderator

    Hello Katie2020,

    Did you use BMI270 github software(https://github.com/BoschSensortec/BMI270-Sensor-API) or other software version?

    Hi 

     

    Yes I am using the code from GitHub

     

    Thanks

    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);
        bmi2_error_codes_print_result(rslt);
        rslt = bmi270_legacy_get_sensor_config(&config, 1, &ss_sens);
        bmi2_error_codes_print_result(rslt);
        rslt = bmi270_legacy_map_feat_int(&sens_int, 1, &ss_sens);
        bmi2_error_codes_print_result(rslt);
    • 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

    BSTRobin
    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?

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist