2021-11-19 10:17 AM
I am implementing a bootloader that will support OTA installation of a new BLE stack if needed. I want to be able to command the FUS to install a new stack and I am utilizing the delete WS and FW upgrade SHCI commands to do this. I am always deleting the stack and programming a new stack from scratch (along with erasing the flash). Currently I am programming in the stack .bin file using JLINK or STM32 programming tools and when tell my bootloader (via UART) to do the FW upgrade, a few resets happen and then the status command that comes back is FUS_STATE_ERROR_IMG_CORRUPT. Every time, regardless of how I program the stack or where I program the stack in flash. Ive even tried new, never used boards to ensure that its not something with keys.
Is there something that needs to happen to the stack image before it gets programmed into flash? Ive read through AN5185 several times and I am following the instructions.
FUS version is 1.2.0
Solved! Go to Solution.
2021-11-22 10:42 AM
Ok, so here is the answer for the next poor soul that encounters this issue. There is a footnote in AN5185 that states:
"CRC is used for authentication and it is not initialized by FUS. If CRC is used by Cortex®-M4 user application, it has to be reset before starting FUS or wireless stack install operations. "
Apparently the FUS utilizes the CRC HW even though FUS does not "initialize" the CRC HW to verify the image CRC. If your application touches the CRC hardware (even if you properly Init/Deinit it) before you install a FUS/Stack image then FUS will report FUS_STATE_ERROR_IMG_CORRUPT after the install process starts. I switched to a SW implementation of CRC and the image installs properly.
2021-11-22 12:23 AM
Hello @BStic.2 ,
Please have a look at this AN5185, and refer to the table "FUS state error values" that will give an overview about the error origin.
Try restart the whole operation by re-loading the binary and send an upgrade command to FUS.
Hope my answer helped you!
When your question is answered, please close this topic by choosing Select as Best.
Imen
2021-11-22 08:17 AM
Yes, I am following 5185. I have restarted and tried more than 50 times and still nothing. Does a CRC need to be added to the binary or is it just a straight copy into flash?
2021-11-22 10:42 AM
Ok, so here is the answer for the next poor soul that encounters this issue. There is a footnote in AN5185 that states:
"CRC is used for authentication and it is not initialized by FUS. If CRC is used by Cortex®-M4 user application, it has to be reset before starting FUS or wireless stack install operations. "
Apparently the FUS utilizes the CRC HW even though FUS does not "initialize" the CRC HW to verify the image CRC. If your application touches the CRC hardware (even if you properly Init/Deinit it) before you install a FUS/Stack image then FUS will report FUS_STATE_ERROR_IMG_CORRUPT after the install process starts. I switched to a SW implementation of CRC and the image installs properly.