diff --git a/cpu/stm32_common/periph/flashpage.c b/cpu/stm32_common/periph/flashpage.c index 28f2af962b..9bbebd36ad 100644 --- a/cpu/stm32_common/periph/flashpage.c +++ b/cpu/stm32_common/periph/flashpage.c @@ -69,6 +69,11 @@ static void _wait_for_pending_operations(void) { DEBUG("[flashpage] waiting for any pending operation to finish\n"); while (FLASH->SR & FLASH_SR_BSY) {} + + /* Clear 'end of operation' bit in status register */ + if (FLASH->SR & FLASH_SR_EOP) { + FLASH->SR &= ~(FLASH_SR_EOP); + } } static void _erase_page(void *page_addr)