From 600727453b891a703bfb718a542fac46069ca6fb Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Wed, 30 May 2018 14:14:29 +0200 Subject: [PATCH] cpu/stm32_common/flashpage: clear EOP bit This was taken from STM32 Cube generated code --- cpu/stm32_common/periph/flashpage.c | 5 +++++ 1 file changed, 5 insertions(+) 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)