Bosch Sensortec Community

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

    Questions on chip_id read of BMI270

    Questions on chip_id read of BMI270

    victorheca01
    Established Member

    hi, all

       I use SPI to connect to BMI270, I have 2 questions:

       1. when I send 0x80 0xff 0xff, I can read MISO as 0xff 0x00 0x24. So 0x24 is chip_id, it is correct.

            when I send 0x80 0xff, I can read MISO as 0xff 0x00.

            which command is correct?

    2. when I read BMI270 status after write_config_file, which command should I use?

         send 0xa1 0xff 0xff and read receive buffer of 3 bytes, byte0: ff, byte 1: ff and byte 2 is the status

        or send 0xa1 0xff and read receive buffer of 2bytes, byte 0: ff, byte 1: the status.

        which is correct?

    Thank you in advance.

     

    3 REPLIES 3

    BSTRobin
    Community Moderator
    Community Moderator

    Hi victorheca01,

    Please note that the first byte received from the device via the SDO line corresponds to a dummy byte and the second byte corresponds to the value read out of the specified register address.

    2023-07-12_15h26_30.png
    I also upload actual SPI waveform on MCU platform for your reference.

    2023-07-12_15h25_31.png

    Do you mean reading BMI270 internal status after loading config file? If yes, the register address should be 0x21.

    There is BMI270 sensor API & example code for your reference on github https://github.com/boschsensortec/BMI270-Sensor-API.It has implemented the driver code for accessing sensor.

    Thank you very much. I understood it. Now I found that software has the following problem:

    In write_config_file(), after 

    rslt = bmi2_set_adv_power_save(BMI2_DISABLE, dev);

    I read chip_id and found that dummy_read = 0xff;
    rslt = bmi2_get_regs(BMI2_CHIP_ID_ADDR, &dummy_read, 1, dev);

    also after  rslt = bmi2_set_regs(BMI2_CMD_REG_ADDR, &data, 1, dev);

    when run rslt = bmi2_get_regs(BMI2_CHIP_ID_ADDR, &dummy_read, 1, dev); I got dummy_read = 0xff;

    looks like when I send any command to BMI270, will get chip_id=0xff. However, at beginning of software to read chip_id, it successfuly return 0x24.  What is the problem? Thanks in advance.

    victorheca01_0-1689196197859.png

    this is the waveform of MOSI when I send bmi2_set_regs(BMI2_CMD_REG_ADDR, &data, 1, dev); 0x7F 0xB6. Thanks

     

    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