AnsweredAssumed Answered

CPU stalling when erasing FLASH on STM32F405

Question asked by x.tony on Jul 15, 2016
Latest reply on Jul 25, 2016 by Clive One
Hello,

I have a scenario as follows: I have a Timer 2 that gets interrupted every 1ms. I try to communicate (only Tx) with an external device every 50ms by calling a function inside Timer 2. When the system is running I am updating the flash of the microcontroller (erase then program) and this is causing my CPU to stall.

Before writing this post I did my homework and I am aware that when a write/erase operation is being performed on flash, accessing the flash causes a CPU stall. To prevent this I am putting all the code, constants, ZI data and all other data on the RAM. I am doing this through Keil uVision's environment. I am also loading my Interrupt Vector Table to RAM by running code similar to that of https://www.keil.com/pack/doc/CMSIS/Core/html/_using__v_t_o_r_pg.html.

I can see in my map file that the functions that I'm calling are stored in RAM (their address starts at 0x200...). This means that CPU should not halt even if I'm running code while the flash is being erased, however this isn't the case. The CPU is stalling and stopping the communication.

Can you please advice? Thanks

Outcomes