cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WBxx programming stack from bootloader always results in FUS_STATE_ERROR_IMG_CORRUPT error

BStic.2
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
BStic.2
Senior

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.

View solution in original post

3 REPLIES 3
Imen.D
ST Employee

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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
BStic.2
Senior

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?

BStic.2
Senior

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.