Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 I2C init ESP32 Internal Status

    BMI270 I2C init ESP32 Internal Status

    Aloe
    Occasional Visitor

    This is just a short nottice.

    I have a setup with an ESP32-S3 and a BMI270, wired via I2C. After some testing and using the API, I was probe testing with the code being unable to init the IMU normally or with randoms inits (being the fail reason INTERNAL_STATUS_REGISTER(0x21) == 0 (NOT INIT)).

    After some testing with different burst writes of config file, I have found that no matter the delay in between. After you have flashed the config file the sensor doesn't rise the bit of init in 0x21 register. But once you read it, it is risen.  So goint to API bmi2.c2250 and duplicating the line
    rslt = bmi2_get_internal_status(&load_status, dev);" so that it is read once and then reread. Makes it so device updates that bit value and you read the right one.

    Hope this helps people that are using API and having unknown init errors.

    1 REPLY 1

    BSTRobin
    Community Moderator
    Community Moderator

    Hi Aloe,

    In the official BMI270 sensor API(https://github.com/boschsensortec/BMI270_SensorAPI), function bmi2_get_internal_status() will first delay for a period of time, waiting for the sensor to initialize before reading the status register. If using the official Sensor API, it has already implemented this operation.

    /*!
    * @brief This API gets Error bits and message indicating internal status.
    */
    int8_t bmi2_get_internal_status(uint8_t *int_stat, struct bmi2_dev *dev)
    {
    /* Variable to define error */
    int8_t rslt;

    /* Null-pointer check */
    rslt = null_ptr_check(dev);
    if ((rslt == BMI2_OK) && (int_stat != NULL))
    {
    /* Wait till ASIC is initialized */
    dev->delay_us(BMI2_INTERNAL_STATUS_READ_DELAY_MS, dev->intf_ptr);

    /* Get the error bits and message */
    rslt = bmi2_get_regs(BMI2_INTERNAL_STATUS_ADDR, int_stat, 1, dev);
    }
    else
    {
    rslt = BMI2_E_NULL_PTR;
    }

    return rslt;
    }

    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