Bosch Sensortec Community

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

    BMI270 Config File

    BMI270 Config File

    mullercw
    Member

    I'm using the SPI bus to access the BMI270. The device can reply to the DEVICE_ID register 0 with 0x24. I can monitor the SPI bus and it seems ok and other devices on the same bus function. When I try toload the config_file array from the Github into the BMI270_REG__INIT_DATA register the INTERNAL_STATUS show "Not Init". The INTERNAL_STATUS shows 0x00 (Not Init) and when I read back from the BMI270_REG__INIT_DATA, it is all the same random value for every register (2B, 2B, 2B.. or 1F, 1F, 1F...).

    I see that I have to load this 8k file to even get basic accelerometer data.

    Does this basic procedure below seem correct?

    ----------------------------------

    //load file to configure
    bmi270_writeregister(dev, BMI270_REG__INIT_CTRL, 0);

    //set Address to 0
    bmi270_writeregister(dev, BMI270_REG__INIT_ADDR_0, 0);
    bmi270_writeregister(dev, BMI270_REG__INIT_ADDR_1, 0);

    //load array file

    bmi270_write(dev, BMI270_REG__INIT_DATA, (uint8_t*)bmi270_config_file, sizeof(bmi270_config_file));

    //Write init CTRL to 1 showing config loaded.
    bmi270_writeregister(dev, BMI270_REG__INIT_CTRL, 1);

    vTaskDelay(300);
    bmi270_readregister(dev, BMI270_REG__INTERNAL_STATUS, &val);

    ----------------------------------
    Can I change bmi270_config_file to {1,2,3,4,5,6,7,8};, load it and should I be able to read this 1-8 back as a test to see if I can write to the device? When I do it, I get the same random data, like this register is locked or something.

    The INTERNAL_STATUS shows 00, not 02 which is failed to load. What is the difference in status?

    10 REPLIES 10

    Minhwan
    Community Moderator
    Community Moderator

    Hello, 

     

    Please check my attached file. 

    Before you upload the configuration file, you should set INIT_CTRL as 0x00. 

    Then, the configuration is done, you should set INIT_CTRL as 0x01. 

    Also you have to upload the configuration file using burst data operation. ( I did 32 bytes each).

    Please let me know if you have any questinos. 

    Thanks, 

    mullercw
    Member

    Thank you for the reply. The status shows that the file is properly downloaded with INTERNAL_STATUS returning 0x01. It take many seconds to download, I will try and squeeze out some of the delays and increasing the burst size.

    The data sheet mentioned "Burst write 8 kB initialization data to Register INIT_DATA (start with byte 0 of initialization data). This requires ca. 6.6ms at 10MHz SPI I/F frequency."

    Is this still accurate?

    I try to burst read an 8K block and it doesn't work for me. Is there something special about this config file that it MUST be loaded in a smaller burst format (32 bytes)? I ask because the prior supplied SW example using 32 byte burst works, but as I increase the burst size or lower some delays, the file load fails. I'd like to confirm that this file can be loaded within 15-30ms.

    Can you confirm this, or is there a device limitation here?

    Minhwan
    Community Moderator
    Community Moderator

    Hello, 

     

    Regarding SPI I/F requirement, it means we guarantee the performance as long as you keep the our spec. 

    If you use out of our spec, it might have some problem.

    In terms of burst read operation, you have to read at least 32 bytes. 32, 64 , 128... because we can only access the multiple of 32 bytes. 

    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];
    /* dev_addr: I2C device address.
    reg_addr: Starting address for writing the data.
    reg_data: Data to be written.
    count: Number of bytes to write */
    // 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