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

    I tried to decrease the variable BHY2_COMMAND_PACKET_LEN to 128 and now it seems to work fine: the error is no longer shown.

    Do you think that having decreased it will not cause any other problem in the system?



    Hi Gianlucamilani,


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