AnsweredAssumed Answered

STM32F4 Dual bank boot & RWW - Fail to flash Bank1 while running from Bank2

Question asked by EGol on Jun 15, 2016
Latest reply on Jun 16, 2016 by Clive One
I'm working with STM32F429NI with 2Mbytes of internal flash

I use the dual bank boot mode & RWW to support FW upgrade to a product. I basically followed the examples I saw at STM32Cube_FW_F4_V1.7.0\Projects\STM324x9I_EVAL\Examples\FLASH\

The user insert a SD with the new FW, the SW identify it, load the FW bin file to memory and flash it to the non-active bank, that is, I start with the SW loaded at 0x8000000 and the BFB2 option byte is 0 (boot from bank 1), then if there is a new FW I flash it to 0x8100000 (after unlock and erase) and after verify it I change the BFB2 to 1 and reset the system. The system is boot from Bank 2 successfully.

Now, when I try to load a new FW version while I'm running from bank 2 I'm doing the same procedure but on Bank 1, that is unlock, erase and flash bank 1 with the new code, verify it and set BFB2 to zero but at that stgae the system hangs!!

When I read the flash with a J-Link at that point I see that bank 1 is all FF, that is, the erase worked but the flashing didn't. I change the bank to all zero and repeat the process to make sure that the erase is working and it is.

I'm checking for error on the calls to HAL_FLASH_Program but I did not see any.

Any idea what I am doing wrong?