2022-04-09 10:41 PM
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.
Solved! Go to Solution.
2022-06-01 02:14 AM
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.
Best Regards
2022-04-13 07:20 AM
Hello,
The FUS is not using the source address (nor the destination address) as it looks for some magic word starting from the beginning of the Flash memory, so you can't use FUS_FW_UPGRADE command with these 2 parameters, this feature isn't available.
For your second question, indeed when you delete your current BLE stack, the FUS will move the SFSA address forward in order to protect only the FUS and make more user space in the flash memory.
Best Regards
2022-04-24 01:59 AM
Thanks. I have another question about the upgrade procedure.
After FUS finds this magic word, where will it install this new FW? will it be installed in the same address it finds it, or will it somehow move this image up the flash memory to an optimal address. my experience with stm32cubeProgrammer and Nucleo board, it seems that FUS installs this image in the same address it finds it and SFSA is set to the the address written in "Start address".
2022-04-25 12:37 AM
Hello,
After FUS finds this magic word, there is two cases:
> If there is only the FUS, the new FW will be installed in the same address the FUS finds it and set the SFSA at this address.
> If there is already a wireless stack, the new FW will be installed at the optimal address
Best Regards
2022-04-25 06:00 AM
So in order to keep as much free space as possible, I will need to receive the new FW and save it somewhere, then delete the current FW, move the new one to the correct place and begin the upgrade procedure. Is it correct?
What happens with FUS upgrade procedure, where do I need to place it in memory and will it be installed in the address it is placed (like stack FW) or that in FUS upgrade, FUS itself knows to move this image and place it in the correct space?
Thanks.
2022-05-02 08:55 AM
Hello,
For wireless stack, we can do this but you can simplify the procedure:
> Receive the new FW and save it somewhere between the end of your application and the start of secure part (SFSA)
> Send FUS_FW_UPGRADE command, this command allows to check the new FW and delete the current FW and install the new FW at the optimal address instead of old FW.
For FUS upgrade, download and save the new FUS FW between the end of your application and the start of secure part (SFSA), then the FUS knows itself the right place to move the image and install it.
Best Regards
2022-05-03 06:20 AM
Hi.
Thanks for clarifying both, stack and FUS, update procedure.
Just one more issue. I was trying to test the procedure with some test cases. Using ST OTA application with some changes I made so the update procedure will start when button 3 was pressed. All tests was working as you described except for the case when the new FW size was bigger than current image size (for example BLE_Stack_full_fw vs BLE_Stack_basic_fw or 1.13 version vs 1.10 version). In those cases, no matter what was the address I loaded the new image to, new image was kept in memory at the same address it was loaded to, SFSA stayed as before and wireless stack was working as before, like nothing happened.
Any idea what may be the reason and how can I solve this problem?
Thanks again.
Yair.
2022-05-04 05:12 AM
Hello,
Can you describe a bit more your test ? Can you give the address where the new image is loaded and the third digit of the stack version and SFSA value ?
Best Regards,
Remy
2022-05-08 01:34 AM
The relevant tests are when BLE stack is already installed at several different addresses, 0x080A2000 (arbitrary address) ,0x080D1000 (for 1.13 BLE_Stack_basic_fw) and 0x080CB000 (for 1.10 BLE_Stack_full_fw). New image to be updated was loaded to address calculated with formula written in AN5185 document:
(current_FW_address - (2 * new_image_size - current_FW_size)).
It was also tested with some lower arbitrary addresses like 0x08070000.
SFSA was set according to current stack installed, like detailed above, and did not changed after update procedure was ended.
Thanks for helping.
Yair.
2022-05-13 09:17 AM
Hello,
Have you perform a flash erase of memory regions between the end of your application and SFSA, in order to clean the flash memory before loading the new image ?
Best Regards