Bosch Sensortec Community

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

    BMI160 firmware upload fails with BHY_CRC_ERROR

    BMI160 firmware upload fails with BHY_CRC_ERROR

    tonyh
    Member

    Hi,

    I have setup where is nRF52840+Zephyr and BHI160B is connected to with i2c @400kHz. BMM150 is connected to BHI160B.

    Most of the BHI160-codes are from: https://github.com/BoschSensortec/BHy1_driver_and_MCU_solution

    Firmware for upload with bhy_initialize_from_rom() is: Bosch_PCB_7183_di03_BMI160_BMM150-7183_di03.2.1.11696_170103.h

    Normal booting sequence is going fine, but bhy_get_crc_host(v_crc_host_u32) returns v_crc_host_u32 = 0xFFFFFFFF. Return value itself is BHY_SUCCESS.

    During the firmware upload (and only time) INT is going low for 5ms, which is abnormal as FW is not uploaded yet. Normally INT reason is not read here, but bhy_get_chip_status() in ISR claims that firmware_idle and no_eeprom are set by 1.

    Overall boot and FW upload:

    BHI_fw_up.jpg

    Begin of FW upload:

    BHI160_FW_up_begin.jpg

    End of FW upload:

    BHI160_FW_up_end.jpg

    Any thoughts, what can be wrong here?

    11 REPLIES 11

    Jet
    Occasional Contributor

    Hi Sir:

        Because there is no length limitation to write FW in bhi160b I2C read and write function when initialize,  you should split the length of read and writing in your interface function. Did you achieve this feature by yourself or it comes with this function for nRF52840 I2C function?

       You can print bhy_get_crc_host() value and v_crc_from_memory_u32 value to observe whether they are the same value to know FW upload successful or not. For example:     PRINT("bhy_get_crc_host=0x%x v_crc_from_memory_u32=0x%x\n\r",v_crc_host_u32,v_crc_from_memory_u32);

       And after load fw, you also need to check two interrupt pin change, which you know from example code. And then the BHI160B initialization is successful. Before fw is loaded, you don't need to care the interrupt pin.

     

    The i2c-write method (.bus_write) is matching 1:1 to Zephyr's API: https://docs.zephyrproject.org/apidoc/latest/group__i2c__interface_gaf995812f31e7bf1ea7f203905db1382...

    Here is the begin of FW upload. Are these byte orders as expected? I also pasted the begin of FW array.

    BHI160_FW_begin_new.jpg

    const unsigned char bhy1_fw[] = {
      0x2a0x650x000x1a0x9a0x310x1b0xe70x000x000x000x00,
      0x740x280x000x00, 0xe80x990x7f0x000x440x190x000x00,
      0x680x8d0x7f0x000x4a0x260x000x700x4a0x260x000x70,
      0x4a0x260x000x700x4a0x260x000x700x4a0x260x000x70,
      0x4a0x260x000x700x4a0x260x000x700x4a0x260x000x70,
      0x4a0x260x000x700x4a0x260x000x700x4a0x260x000x70,

     

    Just soldered more measurement pins. Seems that BHI160 starts some I2C activity to BMM150 direction when INT goes low.

    Big picture of FW upload, upper I2C is from nrf52<->BHI160, lower I2C is between BHI160<->BMM150.

    mag_i2c_1.jpg

    I2C between BHI160<->BMM150 zoomed in. Bus is running @88kHz and its seems scanning something, leading always to NAK. According to our understanding BMM150 I2C address is 0x10.

    mag_i2c_2.jpg

    Does this giving any glue?

    Jet
    Occasional Contributor

    Hi Sir:

          After fw load, it will check BMM150 whether to connect or not due to this fw with BMM150. Meanwhile, I2C between BHI160<->BMM150 and I2C between BHI160<->BMI160(the IMU of internal BHI160B ) are the same I2C lines.

          If you doubt BMM150 interference, maybe you can remove BMM150 and use a new fw without BMM150.

           Did you have the external pull-up resistor to VDDIO on the ASCK and ASDA of the BHI160B in order to enable proper I2C communication?

         Jet_0-1608171990137.png

          I have the example code of STM32 platform, would you like to referenc it ?

     

        

     

    Root cause found as we tried the same config with ESP. Here are two screencaptures of reset-command, upper nrf52 (fails), lower ESP (works). Nrf52 sends device address before data and BHI160 might not recognize even the reset cmd as INT won't go low.

    Now have to find how I can get nrf52 I2C to make similar sequences than ESP. 😑

    reset_cmd_nonwork_work.jpg

    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