2012-08-14 10:43 AM
Hi All,
Has anyone had problems with corrupting their flash programming when power cycling their STM32F4xx board? (or any other STM32 board for that matter) I'm able to use the boot-loader to successfully flash code to an STM32F407 board and use it through several resets. Occasionally when I turn off power to the board, it fails to boot back up, arguably due to corrupted flash programming. Is there any special voltage power-down sequences I need to follow to prevent affecting the internal flash memory at power-down? Are there any pins I could control the voltage on to prevent flash programming from being affected during an unexpected power-down event? I'm not writing any flash sectors during operation, so as long as I can use the boot-loader to reflash the system, I'm happy to lock down all flash sectors in any way possible. Thanks for your time and suggestions! Cheers, Tim #flash2012-08-14 10:55 AM
Occasionally when I turn off power to the board, it fails to boot back up, arguably due to corrupted flash programming.
If so, it should misbehave through further power cycles, until reflashing. I suggest to read out the Flash in this case, and compare it to the original. If the failure disappears after power cycling, this points to a latent bug, or some hardware issue. I never had such a problem with several different discovery boards of differnt type (VL, F0, F4). It has always been bugs...
2012-08-14 10:55 AM
Occasionally when I turn off power to the board, it fails to boot back up, arguably due to corrupted flash programming.
If so, it should misbehave through further power cycles, until reflashing. I suggest to read out the Flash in this case, and compare it to the original. If the failure disappears after power cycling, this points to a latent bug, or some hardware issue. I never had such a problem with several different discovery boards of differnt type (VL, F0, F4). It has always been bugs...
2012-08-14 11:28 AM
As suggested, read out the content of the flash, should be pretty obvious if it's corrupted or not. Then you'd know.
Check that you have the BOOTx pins set suitably for normal operation. The devices should boot using the HSI clock, if you are using the PLL or HSE, you should probably check if these things are working, and stable. A lot of ST's demo code will spin in endless while loops if subsystems aren't working properly. Use your JTAG/SWD debugger and trace through the startup of the device.2012-08-14 04:06 PM
Thanks for the input. I'll read out the contents after the boot failure to see if things are actually getting corrupted. In the meantime, I'm also trying to set the BOR (brown-out reset) level to 2.7-3.6 volts up from its base level and setting the write-protect bits in the flash user option register.
The system seems to work fine again after I reflash it with the boot-loader, so I'm still thinking it's memory corruption, but it could be the firmware hanging on PLLs locking or something else. I'll keep everyone posted on what I find. Thanks again for all the help! Cheers, Tim2012-08-15 08:03 AM
It would really surprise me if the Flash is corruptible that easy.
I assume that the booster stages to generate the erase/program voltages are only fired up when you unlock the Flash properly. And without that rather high voltages, the Flash is physically read-only.2012-08-15 11:20 AM
Hi fm,
I did some experiments yesterday and confirmed that the flash programming was indeed getting corrupted. Here are the steps I went through:2012-08-15 12:23 PM
Do you have any code in your firmware that erase/writes to FLASH/EEPROM?
Do you have any checksum/crc integrity checking in your firmware?2012-08-16 12:15 AM
As said, that surprises me ...
The corrupted bytes were all in page 0 of the flash and the bytes were corrupted to zeros. When erased, the contents are all FFs, so something was driving those flash bits to zero.That is correct, '1' is the erased state of a Flash bit cell, associated with 'no charge on floating gate'. To get the bits to zero, there needs to be an active write. If you can prove that you have no IAP code that is activated under that circumstances, I would contact ST. I have heard rumours about other Flash related issues, but not yet about such a corruption.While I find this unnerving, our team found similar issues on power-down with external SDcard flash parts used with other micro-controllers.
My first assumption would be a process related problem. If those SD cards utilizes Flash produced with the same technology, they would surely share some problems.
2024-06-10 02:21 PM
Hi, I have faced with the same issue and I can add that WP is not working, only BOR to the highest level solved the problem with the corrupted Sector 0 of Flash for STM32F407 MCU. Please find the detailed report here: https://community.st.com/t5/stm32-mcus-products/corrupted-flash-in-vector-table-area-sector-0/m-p/684115/highlight/true#M251736