Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BHI260AP, hostboot mode: Firmware Verify bit (Boot Status reg) does not fill after FW upload via I2C

    BHI260AP, hostboot mode: Firmware Verify bit (Boot Status reg) does not fill after FW upload via I2C

    New Poster

    Dear Community,

    I am using BHI260AP in host boot mode and I have an issue with 'Firmware Verify Done' bit of the Boot Status reg 0x25. It does not fill after FW upload via I2C in the initialization phase. Here I describe better the problem encountered

    The host MCU code is the one from the example quaternion.c in

    At the initialization phase, the host MCU is correctly able to reset the Fuser2 core, to read the BHI260AP ID and perform other initial operations communicating via I2C to the BHI260AP, here the messages from the debug terminal. 

    BHI260/BHA260 found. Product ID read 89
    Host interrupt control
        Wake up FIFO enabled.
        Non wake up FIFO enabled.
        Status FIFO disabled.
        Debugging disabled.
        Fault enabled.
        Interrupt is active high.
        Interrupt is level triggered.
        Interrupt pin drive is push-pull.
    Loading firmware into RAM.



    As visible in the last row of the above message, the board correctly polls the Boot Status register before the FW upload, giving it the permission to start the FW upload via I2C, here below the related code rows from the BOSCH APIs:


    	// Check if the sensor is ready to load firmware:
            // Poll the Boot Status Register (0x25) until the Host Interface Ready bit is set
    	rslt = bhy2_get_boot_status(&boot_status, &bhy2);
    	print_api_error(rslt, &bhy2);
    	if (boot_status & BHY2_BST_HOST_INTERFACE_READY)
    		uint8_t sensor_error;
    		int8_t temp_rslt;
    		SEGGER_RTT_printf(0, "Loading firmware into RAM.\r\n");
    		rslt = bhy2_upload_firmware_to_ram(bhy2_firmware_image, sizeof(bhy2_firmware_image), &bhy2);



    The FW writing via I2C is correctly performed (through the function bhy2_hif_exec_cmd below):

    int8_t bhy2_hif_upload_firmware_to_ram(const uint8_t *firmware, uint32_t length, struct bhy2_hif_dev *hif)
        int8_t rslt = BHY2_OK;
        uint16_t magic;
        if ((hif != NULL) && (firmware != NULL))
            magic = BHY2_LE2U16(firmware);
            if (magic != BHY2_FW_MAGIC)
                rslt = BHY2_E_MAGIC;
                rslt = bhy2_hif_exec_cmd(BHY2_CMD_UPLOAD_TO_PROGRAM_RAM, firmware, length, hif);
                if (rslt == BHY2_OK)
                    rslt = bhy2_hif_check_boot_status_ram(hif);



    But after the FW writing, the verification of the Boot Status register (0x25) that is done immediately after gives uncorrect value, since both the:

    - Firmware verification Done bit

    - Firmware Error bit

    remain not set (they are 0)

    The condition above is never satisfyed(if condition in the below code snippet) , so the error message BHY2_E_TIMEOUT is returned (see below the related part of code).

    Would you be able to suggest me a possible way to fix this error? 

    Thank you  very much


            if ((boot_status & BHY2_BST_HOST_INTERFACE_READY) && (boot_status & BHY2_BST_HOST_FW_VERIFY_DONE) &&
                (!(boot_status & BHY2_BST_HOST_FW_VERIFY_ERROR)))
        if (i == BHY2_BST_CHECK_RETRY)
            return BHY2_E_TIMEOUT;


    6 REPLIES 6

    Community Moderator
    Community Moderator

    Hi Gianlucamilani,

    1. What about your hardware schematic?
    2.The firmware must be written as soon as possible (such as burst write). Can you check whether the MCU hardware driver supports fast writing?
    3.Attached example code run on STM32 for your reference.

    Here the schematic part related to the sensor. I am using a level shifter to adapt the voltage levels between MCU and BHI260AP. As stated in the post, the initial I2C messages are correctly arriving (reset, device ID)

    I verified the MCU capabilities and implementing i2c burst mode is not straight-forward. My current write frequncy anyways is 400kHz.






    Dear Robin,


    I found out that probably the maximum I2C transfer size for my MCU is 255 for each transaction (see

    But I noticed that during the FW upload on the BHI260AP, the BOSCH API tries to send 256 bytes in one transaction: 

    in particular, I found out that the define BHY2_COMMAND_PACKET_LEN is equal to 256 and this variable is used inthe function for the FW upload.

    Do you know a safe way to write the FW in less than 256 byte at a time (for each transaction). The API function I am referring to is the bhy2_hif_exec_cmd_generic

    Thank you very much



    Hi Gianlucamilani,

    The schematic diagram is not clear, and the detailed schematic diagram cannot be seen.

    Generally, the read/write length in the API cannot be greater than the maximum length supported by the host MCU hardware I2C.