Dual Flash Memory Bank Swap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-17 1:32 AM
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
- Labels:
-
Flash
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-17 8:22 PM
I know you said you checked it, but I would put a check to verify the memory is 0xFFFFFFFF right before the HAL_FLASH_Program call. And when the values don't match, print out the address and the values to help debug.
I would also put a check to verify that (destination + i * 4) is still within flash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-18 1:31 AM
Yes you are right,
I found the problem, *(__IO uint32_t *)(destination + (i * 4)) return BANK2 values but destination address is BANK1 why this happened I dont understand.
READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_UFB_MODE) return BANK2 value .But in the below line compare with BANK2 values although destination=0x0800000 (BANK1). How can I solve this problem ?
if (*(__IO uint32_t *)(destination + (i * 4)) != *(uint32_t *)(p_source + i))
Why the *(__IO uint32_t *)(destination + (i * 4)) value return from BANK2 although destination is 0x0800000 (BANK1) address ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-18 5:32 AM
How Can I solve this problem ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-18 6:18 AM
Bit 8 FB_MODE: Flash Bank mode selection
Set and cleared by software. This bit controls the Flash Bank 1/2 mapping.
0: Flash Bank 1 is mapped at 0x0800 0000 (and aliased at 0x0000 0000) and
Flash Bank 2 is mapped at 0x0810 0000 (and aliased at 0x0010 0000)
1: Flash Bank 2 is mapped at 0x0800 0000 (and aliased at 0x0000 0000) and
Flash Bank 1 is mapped at 0x0810 0000 (and aliased at 0x0010 0000)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-18 6:42 AM
Thank you so much TDK
checkBank=READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_UFB_MODE)
if(checkBank==0){
serialMessage(" Program Running in Bank 1 \n");
}else{
serialMessage(" Program Running in Bank 2 \n");
}
I see Program Running from Bank2 so, this meaning BANK2 mapped 0x08000000 address, so I have to use 0x0810000 value for the BANK1. Is that true ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-18 6:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-18 7:43 AM
But there is a problem, If I have "Program Running in Bank 2" output this if-else than I try to erase 0x08100 0000 but there is problem here because I am in 0x0810 000 area I can not erase.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-18 7:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-18 8:03 AM
Okey I found the problem, after you said I change flash write address to 0x810000 but I cant change BFB2 bit so I switch every time reset so problem solved thank you.
