Skip to content

Commit

Permalink
Added call to clear PG bit after Writing to Flash (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnymajani authored and xor-gate committed Mar 7, 2019
1 parent d13f946 commit 522188d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static void set_flash_cr_pg(stlink_t *sl) {
stlink_write_debug32(sl, cr_reg, x);
}

static void __attribute__((unused)) clear_flash_cr_pg(stlink_t *sl) {
static void clear_flash_cr_pg(stlink_t *sl) {
uint32_t cr_reg, n;

if (sl->flash_type == STLINK_FLASH_TYPE_F4)
Expand Down Expand Up @@ -2008,6 +2008,7 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t
}

/* Relock flash */
clear_flash_cr_pg(sl);
lock_flash(sl);

} //STM32F4END
Expand Down

0 comments on commit 522188d

Please sign in to comment.