2013-10-03 11:42 AM
Hi everyone, sorry if this has been answered before and my google-fu is weak.
I'm experimenting with an STM32F207VG, and after reading the flash manual and data sheet, am uncertain if it's ''safe'' to execute code from one sector of flash while erasing / programming another sector. Note that these sectors are in the same bank.Does anyone have a definitive answer to this? All advice welcome.Thanks in advance,Charles #stm32f207-flash2013-10-03 11:55 AM
Yes, you can definitely do it, however it WILL stall the processor while the ERASE or WRITE is busy, and that can be a very long time.
Don't erase the block you are running from, or that contains the vector table. Anything that touch flash will cause the stall, which is like stuffing wait-states into the processor, and nothing else will complete. Some of the 128KB blocks can take several seconds to erase, peripherals will overflow/underflow. You need to consider a flow control protocol, like X-Modem, to hold of data flow while the CPU is busy. You can run code from RAM (including vector table). You can avoid the stall in 2MB parts (F4) by using the other bank.2013-10-03 12:47 PM
Thanks for the quick and concise answer!
2015-04-17 12:53 AM
Hi Clive1,
Sorry to bother you. I am stuck with an issue about MCU Flash erase. Could you help to instruct me how to solve it? At first, I run my main application 'AA' at address 0x08000000 and this main program just copy another image(called 'UU', stored in SPI flash) into SRAM to jump to 'UU'. So at this moment time, 'UU' is running well on SRAM(address 0x20000000). I wonder if Prgram 'UU' can erase MCU flash(especially, those sectors used by main program 'AA'). In fact, program 'UU' is failedto erase MCU Flash(memory sectors occupied by main program 'AA'). Could you give me some hint or example to solve this trouble issue.2015-04-17 03:40 AM
Off-topic, lets use your [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/If%20a%20standalone%20program%20running%20on%20SRAM%20can%20erase%20MCU%20Flase&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx¤tviews=8]other thread as a vehicle to address this...