Question
Flash page erase blocking on STM32F100
Posted on June 06, 2013 at 17:58
Hi i've read all the post I could find on the subject and I know that accessing the flash during an erase command will stall the MCU. However the code i'm looking at is not accessing the flash (that's what i believe) and is taking too long:
switch(ActualFlashJob->type) { case FLASH_PAGE_ERASE: FLASH->CR |= FLASH_CR_PER; FLASH->AR = ActualFlashJob->address; m_EnterCritical(); t1 = GetTime(); FLASH->CR |= FLASH_CR_STRT; // This line takes 5.65ms t1 = GetTime() - t1; m_ExitCritical(); break;This is part of the flash driver. GetTime() will return an internal counter in 125ns increment. Enter and Exit Critical will save/restore context and disable/enable interrupts.The fact that setting the start bit takes 5ms+ to execute is beyond me.Anyone has a tought on that?Thanks,Justin #stm32-flash-erase-page #flash