cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F207, Execute while programming flash?

charles1
Associate
Posted on October 03, 2013 at 20:42

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-flash
4 REPLIES 4
Posted on October 03, 2013 at 20:55

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
charles1
Associate
Posted on October 03, 2013 at 21:47

Thanks for the quick and concise answer!

blacksu6
Associate II
Posted on April 17, 2015 at 09:53

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.

Posted on April 17, 2015 at 12:40

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&currentviews=8]other thread as a vehicle to address this...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..