Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMI270 initialization sequence with python

    BMI270 initialization sequence with python

    abalog_2022
    Member

    hi all, 

    I'm facing a problem with initial configuration of bmi270 using python.

    Looking at its datasheet and configuring the device for normal power mode without the initialization sequence it doesn't work.I understand that config file must be loaded,but how can i load the config file with PYTHON SCRIPT in order to get BMI270 working? becouse now if i read data register  (DATA_8 - DATA-13) without inizialization sequence i get always zero

    I hope you can help me

    Thanks and regards,

    TESTING COMUNICATION
    bus.read_byte_data(0x68, 0x00->   responde 0x24  COMUNICATION OK 
    -----
    INIZIALIZATION SEQUENCE
    bus.write_byte_data(0x68, 0x7C, 0x00)
    time.sleep(0.005)
    bus.write_byte_data(0x68, 0x59, 0x00)
    bus.write_i2c_block_data(0x68, 0x5E, bmi270_config_file
    bus.write_byte_data(0x68, 0x59, 0x01)  
    ------------
    CHECKING THE CORRECT INIZIALIZATION STATUS
    bus.read_byte_data(0x68, 0x21->   responde 0  INIZIALIZATION ERROR
    ----------
    NORMAL POWER MODE
    bus.write_byte_data(0x68, 0x7D, 0x0E)
    bus.write_byte_data(0x68, 0x40, 0xA8
    bus.write_byte_data(0x68, 0x41, 0x02)
    bus.write_byte_data(0x68, 0x42, 0xA9)
    bus.write_byte_data(0x68, 0x7C, 0x02)
    data8 = bus.read_byte_data(0x68, 0x0C) -> 0
    data9 = bus.read_byte_data(0x68, 0x0D-> 0
    data10 = bus.read_byte_data(0x68, 0x0E-> 0
    data11 = bus.read_byte_data(0x68, 0x0F-> 0
    data12= bus.read_byte_data(0x68, 0x10-> 0
    data13 = bus.read_byte_data(0x68, 0x11-> 0
    ---------------
     
     
    5 REPLIES 5

    BSTRobin
    Community Moderator
    Community Moderator

    Hello abalog_2022,

    There was BMI270 reference driver code and exmaple code based on C language on github.
    https://github.com/BoschSensortec/BMI270-Sensor-API

    As you used didn't used BMI270 reference API and operate register directly, you can still refer to the API to access the process of loading configuration files.
    bmi2_write_config_file()
    {
    ...
    /* Write the configuration file */
    rslt = write_config_file(dev);
    if (rslt == BMI2_OK)
    {
    /* Check the configuration load status */
    rslt = bmi2_get_internal_status(&load_status, dev);

    /* Return error if loading not successful */
    if ((rslt == BMI2_OK) && (!(load_status & BMI2_CONFIG_LOAD_SUCCESS)))
    {
    rslt = BMI2_E_CONFIG_LOAD;
    }
    }
    ...
    }

    unfortunately the c example doesn't help.

    it would be more helpful have a specific like this "memory address - byte to write", so that you can implement it with the following python command:
    bus.write_byte_data (device_address, register, byte)

    BSTRobin
    Community Moderator
    Community Moderator

    Hello abalog_2022,

    The reference code is written in C language. You can refer to the logic of the code.

    alal2022
    Occasional Visitor

    The problem should be

    After bmi270_config_file sent, why the Internal_status register(0x21) return 0x00 (ASIC is not initialized).

    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