cancel
Showing results for 
Search instead for 
Did you mean: 

Wireless stack and FUS image addresses for upgrading

YWor.1
Associate III

Hello.

I'm planning a project that will use large amount of flash memory, therefore, I will need to be cautious with memory saved for app updates.

I'm using STM32WB55VGQ6 with 1MB of flash memory on custom designed board. my current application is about 300KB and it will grow larger.

I read in AN5185 document that when I send FUS_FW_UPGRADE command, there is an option to add address for image location and image destination. When I started to check this option, I have read @Remi QUINTIN in https://community.st.com/s/question/0D53W00001MwMvLSAV/shcic2fusfwupgrade-usage that this option is not used and FUS knows to locate the image address by finding some magic word and it finds the destination by itself. I wanted to know if this feature is optionally and can I use it by sending these 2 parameters with FUS_FW_UPGRADE command?

Another question, if I'm deleting current BLE stack before updating, will the FUS move the SFSA address forward and make some more user space in the flash memory?

Thanks.

13 REPLIES 13

Hi.

From what I remembered, I was erasing the flash on every test. Just to be sure, I just now tried those scenarios: 1.10 BLE_Stack_full_fw is running and SFSA set to 0xCB, erased both full chip and selected sectors between OTA app and SFSA, download 1.13 BLE_Stack_full_fw to address 0x08090000. FW_Upgrade initiated and after several seconds a system reset was detected and when CPU2 asynch event occurred, FUS is running and image is still loaded, like no upgrade happened.

Regards.

Yair.

Update:

I tried some more tests and figure out that what was causing the system resets is receiving FUS error on FUS_State command. The error code received is 0x04 - FUS_SATE_NO_ENOUGH_SPACE.

That made me think that the formula written in AN5185 may be mistaken. Formula for new image larger than current FW is:

WirelessStackAddress - (2xImageSize – WirelessStackSize). In my case: 0xCB-(2*0x2D-0x29) = 0x9A. Didn't work, same error received.

I tried to change formula to: WirelessStackAddress - 2xImageSize. In my case: 0xCB-2*0x2D = 0x71. Didn't work, same error received.

Another try to change formula to: ImageAddress(from release notes document) - 2xImageSize. In my case: 0xC7-2*0x2D = 0x6D. Finally, That worked, version was updated, SFSA was set to 0xC7 and FW stack Started automatically.

Just to be sure about this address, I downgrade version back to 1.10 and tried to load 1.13 to 0x6E. Upgrade received FUS_SATE_NO_ENOUGH_SPACE error again.

Can you please check that I am not mistaken, that there is a problem in the formula?

Thanks.

Yair.

Remy ISSALYS
ST Employee

Hello,

The formula in the AN5185 will be updated soon. According to this update, use the following formula to calculate the most optimized download address:

1/ When the update is larger that the running wireless Firmware:

Download Addr = OldStackAdd(=SFSA) - NewStackSize(4Kb aligned) - 1 Sector

2/ When the update is smaller that the running wireless Firmware:

Download Addr = OldStackAdd(=SFSA) - NewStackSize(4Kb aligned)

I have perform some tests and there isn't any problem to update wireless stack between v1.10 and v1.13.

  • Full stack v1.10 to full stack v1.13, see formula 2 :
    • Download Addr = OldStackAdd(=SFSA) - NewStackSize(4Kb aligned) = 0x080CB000 - 0x00024000 = 0x080A7000

  • Full stack v1.13 to full stack v1.10, see formula 1:
    • Download Addr = OldStackAdd(=SFSA) - NewStackSize(4Kb aligned) - 1 Sector = 0x080D0000 - 0x00029000 - 0x00001000 = 0x080A6000

Best Regards

I have tried this new formula and it actually works.

I had 1.10 BLE_Stack_full_fw running and SFSA set to 0xCB. 1.13 BLE_Stack_full_fw size(4Kb aligned) is 0x2D, so Download Addr = 0x080CB000 - 0x0002D000 - 1 Sector = 0x0809D000.

Looks like new formula is working, plus it needs less flash space for Stack upgrade which is also very good news for my purpose.

Thanks for all the tips and advices.

Yair.