2021-05-06 09:28 AM
I am working with the STM32F429 discovery board trying to prove out the ability to do OTA updates via a connected cell modem, but I am having trouble getting the MCU to boot from bank 2. I have created 2 simple freeRTOS applications which blink the onboard LEDs in different configurations and watch for a press of the user button to switch to the other memory bank. I have flashed each application individually at memory address 0x8000000 to verify that they execute properly. Then I flashed one application at 0x8000000 and the other at 0x8100000 using the STM32CubeProgrammer tool and then read out the memory at each location to verify that they were successfully programmed. Finally, I have tried a coupled different approaches to swapping the memory bank that is executed, but neither way has worked as expected.
The first thing I tried was setting the BFB2 bit when the user button was pressed and then resetting. I verified that the BFB2 bit was successfully set, but when I reboot the board I don't have any blinking LEDs. When I use the programmer tool to read the PC it looks like the device is getting stuck in system memory for some reason.
My second attempt was reading the FB_MODE bit and then either setting it or clearing it depending on the current state. By doing this, I was sometimes able to get my application in bank 1 to switch over and start running my application in bank 2, but the results were inconsistent. If the application didn't successfully switch to bank 2, my application in bank 1 stopped blinking the LEDs at all. In the cases where I am able to switch to the application in bank 2 by setting the FB_MODE bit, I have never been able to switch back to bank 1 by clearing the bit.
I have looked through the reference manual, all sorts of forum posts, and various application notes, but I can't seem to find any clear answers on the proper way to swap memory banks for the purpose of a firmware update.
Solved! Go to Solution.
2021-05-28 02:39 AM
Hello @JDrew.469 ,
There are some examples provided by ST under Firmware\Projects\STM32F7508-DISCO showing how to jump from one memory area to another. You can get inspiration from them.
Moreover, take a look at this reference : https://stm32f4-discovery.net/2017/04/tutorial-jump-system-memory-software-stm32/
I hope this help you.
BeST Regards,
Walid
2021-05-28 02:39 AM
Hello @JDrew.469 ,
There are some examples provided by ST under Firmware\Projects\STM32F7508-DISCO showing how to jump from one memory area to another. You can get inspiration from them.
Moreover, take a look at this reference : https://stm32f4-discovery.net/2017/04/tutorial-jump-system-memory-software-stm32/
I hope this help you.
BeST Regards,
Walid
2024-08-20 02:58 AM
Hello @JDrew.469, I'm also working with STM32F429I discovery to test the dual boot mechanism but I'm stuck pretty much where you were:
- I tried setting the BFB2 bit, it seems the board actually boots from bank 2 but is stuck at a very early stage and doesn't blink any LED.
- I tried force setting the FB_MODE bit too (are we supposed to do that ? isn't this bit set by the hardware upon reset according to the value of BFB2 bit ?), but again I get stuck with no blinking LEDs.
STM32 ST-Link Utility (similar to STM32CubeProgrammer) tells me the BFB2 bit is properly set and the flash (both banks) actually contains my program so everything looks good.
My implementation does exactly what's described in https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM324x9I_EVAL/Examples/FLASH/FLASH_DualBoot, so I don't know what to do next.
What did you do to solve your problem ?
2024-08-21 06:45 AM
After some more digging, I found the answer in this post:
#define USER_VECT_TAB_ADDRESS
The address of the interruption table is forced to 0x0800'0000 in SystemInit() for both banks and everything works fine.