clean SR flags before programming CR
authorBruno Dal Bo <bruno.dalbo@hp.com>
Wed, 3 Feb 2016 21:10:54 +0000 (13:10 -0800)
committerBruno Dal Bo <bruno.dalbo@hp.com>
Wed, 3 Feb 2016 21:10:54 +0000 (13:10 -0800)
src/stlink-common.c

index f2888d10b4a1ad1b072d83e96e39b7a6915dd66d..04e616762fe0ce901f623bc4cc3ca5d0ae7d5405 100644 (file)
@@ -432,6 +432,7 @@ static inline void write_flash_cr_snb(stlink_t *sl, uint32_t n) {
 }
 
 static inline void write_flash_cr_bker_pnb(stlink_t *sl, uint32_t n) {
+    stlink_write_debug32(sl, STM32L4_FLASH_SR, 0xFFFFFFFF & ~(1<<STM32L4_FLASH_SR_BSY));
     uint32_t x = read_flash_cr(sl);
     x &=~ STM32L4_FLASH_CR_OPBITS;
     x &=~ STM32L4_FLASH_CR_PAGEMASK;