cancel
Showing results for 
Search instead for 
Did you mean: 

Dual Flash Memory Bank Swap

DCtech
Associate II

I want to try dual-bank project in my STM32F429 Board. So I am using Stm32Cube : IAP-LWIP Example for the this project. I am using 

0x08000000

 address for the BANK1 and also I am using 0x08100000 address for the BANK2.

  • When I start the BANK1, than I receive firmware update request from TFTP Client and find which bank active then, I cleaned non-active bank and writing code in BANK2 successfully.

*Then I reset the system and system starting BANK2, when I request again for the update code. BANK1 cleaned successfully . But I can not write code successfully. I have this error: 

FLASHIF_WRITINGCTRL_ERROR

12 REPLIES 12
hiharsh
Associate II

Hi ,

I am running in to the issue where I flashed the image to 0x81000000 while booted with 0x80000000.

I made sure, I follow the every steps mentioned in the reference manual. However, I can't seem to get this 100 percent working.

On 1st boot it switches and boots the image located at 0x81000000 but successive upgrade always boots the image located at 0x810000. It should switch to the image located at 0x8000000.

To confirm that above behavior is consistent, ​

1. I flashed one image at 0x80000000 and then flashed a second image at 0x81000000 (tweaked linker script).

2. I wrote a function where ​on every few seconds I call bankSwitchandBoot function.

In this function I d the following

1.Unlock flash

2.Unlock option byte

3.Set OPTIONBYTE_BOOTCONFIG

4.Set ​bootconfig=OB_DUAL_BOOT_ENABLE

5.Sett DB1M Bit in OPTCR_BYTE2_ADDRESS

6.Get the current active bank

If current active bank is bank 1.

Enable bank swapping.

else

Disable bankswapping

7. Program option byte and check for errors (no errors are reported)

8. Lock Option byte

9. Lock flash

Could some one please confirm if the above sequence is correct or send a code snippet to have successful memory bank swapping? ​

​I would appreciate your quick response as such I am stuck on this issue for the last couple of days.

bsehnert
Associate

I'm also working the STM32F429VE,  which is the 512K byte flash part.
Does it support dual bank?   Or is only for 1M byte parts.

 

It probably doesn't but surely it's pretty easy to dump the entire memory space, or probe it, and flip the bits for banks, etc.

Most of these parts use the same die, and then sub-portions of the memory are tested to reduce time and costs.

You'd be looking at the 0x08000000 and 0x08080000 memory addresses. If it doesn't Hard Fault then the 1MB is present.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..