aboutsummaryrefslogtreecommitdiff
path: root/lib/stm32/f1/flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stm32/f1/flash.c')
-rw-r--r--lib/stm32/f1/flash.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/stm32/f1/flash.c b/lib/stm32/f1/flash.c
index 49f182c..babfc45 100644
--- a/lib/stm32/f1/flash.c
+++ b/lib/stm32/f1/flash.c
@@ -52,6 +52,9 @@ void flash_set_ws(u32 ws)
void flash_unlock(void)
{
+ /* Clear the unlock state. */
+ FLASH_CR |= FLASH_CR_LOCK;
+
/* Authorize the FPEC access. */
FLASH_KEYR = FLASH_KEYR_KEY1;
FLASH_KEYR = FLASH_KEYR_KEY2;