Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BMI270 Config file load problem

    Sara_r
    Member

    Re: BMI270 Config file load problem

    Hi,

     

    I tried using burst write to load the config file 32 bytes at once, but it failed. It looks like my MCU only supports the write/read length of 2 bytes and one byte. So I have two question:

    1. Is it okay if I use burst write to load the config file two bytes at once in the while loop? 

    2. Could you please expain the example code you replied in this post before? Here's the part that confuses me:

    Wire.beginTransmission(BMI270_ADDR);
    Wire.write(INIT_ADDR_0);
    Wire.write(0x00);
    Wire.write(file_count_);
    Wire.endTransmission();

    Does this mean you wrote both "0x00" and "file_count_" into INIT_ADDR_0 every time when looping? 

    Sara_r
    Member

    Re: BMI270 Config file load problem

    A supplyment of my last question:

    I tried writing two bytes into the register INIT_ADDR_0. (e.g I wrote 0xc8, 0x2e) However, the data I read from INIT_ADDR_0 is always 0x24 and 0x21. This is also resulted when I test other registers like INIT_CTRL other than INIT_ADDR_0.

    Also, if I wrote one byte into INIT_ADDR_0, only the last 6 bit of the data can be write/read. (I wrote 10001000 into INIT_ADDR_0. But I read 001000 from it after that.)

    Minhwan
    Community Moderator

    Re: BMI270 Config file load problem

    Hello Saa, 

     

    First, your system supports burst read operation. 

    If yes, could you follow below code? 

    config_size = sizeof(bmi2xx_config_file);
    file_count = 0;

    while (config_size > 0)
    {

    Wire.beginTransmission(BMI270_ADDR);
    Wire.write(INIT_ADDR_0);
    Wire.write(0x00);
    Wire.write(file_count);
    Wire.endTransmission();

    byte reg_data[32];
    // Begin I2C communication with provided I2C address
    Wire.beginTransmission(BMI270_ADDR);
    Wire.write(INIT_DATA);
    // Done writting, end the transmission
    Wire.endTransmission();


    // Requests the required number of bytes from the sensor
    Wire.requestFrom((int)BMI270_ADDR, (int)32);

    // Reads the requested number of bytes into the provided array

    uint16_t i = 0;

    for (i = 0; (i < 32 ) && Wire.available(); i++)
    {
    reg_data[i] = Wire.read(); // This is for the modern Wire library
    Serial.print(reg_data[i]);
    Serial.print(" ");
    }

    Serial.println("\t");


    filepos += 32;
    file_count += 1;
    config_size -= 32;
    delay(1);
    }

    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