2020-03-17 01: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.
*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
2020-03-17 08: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.
2020-03-18 01: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 ?
2020-03-18 05:32 AM
How Can I solve this problem ?
2020-03-18 06:18 AM
2020-03-18 06: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 ?
2020-03-18 06:44 AM
2020-03-18 07: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.
2020-03-18 07:48 AM
2020-03-18 08: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.