2025-04-07 11:14 PM - last edited on 2025-04-08 1:39 AM by mƎALLEm
Hi everyone,
I'm using STM32G474 with dual-bank Flash enabled (nDBANK = 0) and booting from Bank2 (BFB2 = 1). I'm implementing OTA firmware update by writing to the inactive bank while executing from the active one.
The update from Bank1 → Bank2 works fine.
But in the second update cycle, when running from Bank2 and trying to write to Bank1 (starting at address 0x08000000), HAL_FLASH_Program() always fails on the first double-word.
I have:
Verified that Write Protection is disabled (checked in STM32CubeProgrammer)
Unlocked Flash properly
Erased the target pages beforehand
No PCROP or secure area configured on Bank1
Flash error flag is HAL_FLASH_ERROR_WRITE_PROTECTION sometimes (even though WRP is not set)
I found some similar cases reported online (e.g. this one) where users mentioned that writing to Bank1 from Bank2 fails silently.
Is there an undocumented silicon limitation on STM32G4 when programming Bank1 from Bank2?
I would appreciate any official clarification or workaround from ST or others who solved this.
Thanks in advance!
Solved! Go to Solution.
2025-08-17 12:39 PM
Thank you @cuong.
I work with a STM32L4A6, and the principle it is the same
I did a lot of test to find this.
I will check the application notes again , as I don't remember whether this information is mentioned there.
Pierre
2025-08-17 6:06 PM
Thank you@PCu1
I’ve already managed to solve it.
Thank you for reaching out!