Bosch Sensortec Community

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

    BHI260AB firmware SHA hash mismatch

    BHI260AB firmware SHA hash mismatch

    mra
    Member

    I am interfacing with the BHI260AB shuttle board over I2C using a Cortex M0 as the host MCU (Adafruit Feather M0 board). I use the 'load_firmware.c' example code provided with the BHY2 Sensor API to upload firmware to the external flash chip on the shuttle board. The firmware file I included in my code is the 'Bosch_SHUTTLE_BHI260_BMM150-flash.fw.h' file supplied with the BHY2 Sensor API. After uploading the firmware and booting the BHI260AB from flash, the Error Value register reports a 0x12 error ("SHA hash mismatch") and the Boot Status register activates the 'Flash Verify Error' bit.

    I have made the following modifications to the example code:

    • Changed to I2C interface
    • Included custom functions for I2C read & write operations and a delay function
    • Removed lines relating to COINES
    • Replaced printf statements with appropriate printing statements for the Arduino framework
    • Included a check on the result of the bhy2_upload_firmware_to_flash_partly function to ensure that the firmware is being received
    • Decreased the size of the increment in the 'upload_firmware' function to 200, because the default 256 increment leads to a timeout error

    I have also created an alternative firmware file using the BHI260 SDK, using the default configuration that comes with the SDK. At 1 point this firmware was uploaded correctly and after booting from flash a valid kernel version was reported, but at the next attempt with the exact same code and firmware it reported the SHA hash mismatch again.

    I am suspecting that some bytes are getting lost in data transfer to the flash chip, but I have no clue what could cause that. Any possible clues are appreciated!

    For reference, these are my I2C read and write functions:

    int8_t user_i2c_read(uint8_t reg_addruint8_t *reg_datauint32_t lenvoid *ptr) {
        uint16_t ndone = 0;
        uint8_t nread;
        uint8_t stop = 0;

        Wire.beginTransmission(BHI_I2C_address);
        Wire.write(reg_addr);
        Wire.endTransmission();
        while (ndone < len) {
          nread = min(255,len-ndone);
          ndone += nread;
          if (ndone == len) {
            stop = 1;
          }
          Wire.requestFrom(BHI_I2C_address,nread,stop);
          for (uint8_t i = 0; i < nread; i++) {
            *reg_data = Wire.read();
            reg_data++;
          }
        }
        
        return 0;
    }

    int8_t user_i2c_write(uint8_t reg_addrconst uint8_t *reg_datauint32_t lenvoid *ptr) {
        Wire.beginTransmission(BHI_I2C_address);
        Wire.write(reg_addr);
        while (len--) {
          Wire.write(*reg_data);
          reg_data++;
        }
        
        Wire.endTransmission();
        
        return 0;
    }
    5 REPLIES 5

    Vincent
    Community Moderator
    Community Moderator

    Did you try with APP2.0 + BHI260 shuttle + DD2.0 setup first for upload the FW to flash?

    Or did you try with FW upload to RAM?

    At the same time,  did you adding the connetor to short J7 on the shuttle board?  to boot from external flash,  the hostboot pin should be low during power on.  this means J7 should be shorted. 

    Thank you for your assistance!

    • I do not have the application board, and I prefer to do without it. Eventually I need to get it working without the application board anyway.
    • I was already shorting jumper J7, so that is not the issue (boot status register also reports 1's for flash detected and flash installed bits).
    • Uploading to RAM does work correctly with the same example script, commenting out the UPLOAD_FIRMWARE_TO_FLASH definition. I am getting a valid kernel version.

    What does this tell us about the problem? I2C data transfer seems to be alright, since it manages to upload the firmware to RAM without any problem. I can't imagine it's a power issue, the Feather M0 host board provides 500 mA peak current over its 3V3 output. Would the J2 and J3 configuration on the shuttle board make any difference? J2 is shorted, J3 is shorted as well between the middle and the outer pin (the outer pin being the one that is closest to pin 1 of the shuttle board connector).

    Vincent
    Community Moderator
    Community Moderator

    J2 and J3 in their default positon.  those should not be a problem.

    What is the voltage level you supplied to BHI260AB shuttle board? 

    From your latest description, i will say the bus communication is correct.  The RAM patch can be download and start correctly.  

    Also the SDK was tested before release for flash version.  if you don't change any setting, it should work directly without issue. 

    Did you try with different BHI260AB shuttle board? 

    The voltage level must have been the problem. I was powering it from the 3V supply on the Feather M0, i.e. at 3.3 V. I completely overlooked the 1.8V prescription in the shuttle board flyer.

    Would it work if I power the shuttle board at 1.8V with an external power supply? Or should the host MCU and the shuttle board be powered by the same power source for correct functioning? And what voltage should I use for the pull-up resistors of the I2C lines, 3.3V of 1.8V?

    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