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? thanks, Gianluca
... View more
Dear Robin, I found out that probably the maximum I2C transfer size for my MCU is 255 for each transaction (see https://devzone.nordicsemi.com/f/nordic-q-a/50513/twi-maximum-data-transfer-size-in-nrf52832) 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 Gianluca
... View more
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. Thanks, Gianluca
... View more
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 https://github.com/boschsensortec/BHY2-Sensor-API/tree/master/examples. 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.
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);
if (boot_status & BHY2_BST_HOST_INTERFACE_READY)
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;
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 Gianluca 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)
... View more