Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2018-09-20 18:38:14 +0300
committerKarl Palsson <karlp@tweak.net.au>2019-06-03 01:18:14 +0300
commit53ce5aa3ddf17e588b245f0ab29e18073505684b (patch)
tree70e67cb022c18c0a936eab43aea7823a528bc0d5
parent833ddd9b0a6c8ddfc6003cf49b80a1661f2def3e (diff)
stm32:l4:flash: Fix option bytes programming
FLASH_CR_OPTSTRT needs to be written to FLASH_CR, and there is no reason to mask the last two data bits. Signed-off-by: Bruno Randolf <br1@einfach.org> Reviewed-by: Karl Palsson <karlp@tweak.net.au> (original code appeared to be badly copied from the flash_common_f24 codebase)
-rw-r--r--lib/stm32/l4/flash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/stm32/l4/flash.c b/lib/stm32/l4/flash.c
index 6381197b..2aff56a6 100644
--- a/lib/stm32/l4/flash.c
+++ b/lib/stm32/l4/flash.c
@@ -196,8 +196,8 @@ void flash_program_option_bytes(uint32_t data)
flash_unlock_option_bytes();
}
- FLASH_OPTR = data & ~0x3;
- FLASH_OPTR |= FLASH_CR_OPTSTRT;
+ FLASH_OPTR = data;
+ FLASH_CR |= FLASH_CR_OPTSTRT;
flash_wait_for_last_operation();
}
/**@}*/