AnsweredAssumed Answered

Flash page erase blocking on STM32F100

Question asked by Gornstar on Jun 6, 2013
Latest reply on Jun 7, 2013 by Gornstar
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) {
          FLASH->CR |= FLASH_CR_PER;
          FLASH->AR = ActualFlashJob->address;
          t1 = GetTime();
          FLASH->CR |= FLASH_CR_STRT;     // This line takes 5.65ms
          t1 = GetTime() - t1;

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?