Skip to content

Commit

Permalink
WB55: fix flash verification error (#816)
Browse files Browse the repository at this point in the history
* Clear previously written page number (if any)
* Remove unrelated change
  • Loading branch information
eupn authored and xor-gate committed Jul 14, 2019
1 parent 84f63d2 commit 625f4cd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1759,8 +1759,11 @@ int stlink_erase_flash_page(stlink_t *sl, stm32_addr_t flashaddr)
if (sl->flash_type == STLINK_FLASH_TYPE_WB) {
uint32_t flash_page = ((flashaddr - STM32_FLASH_BASE) / sl->flash_pgsz);
stlink_read_debug32(sl, STM32WB_FLASH_CR, &val);

// sec 3.10.5 - PNB[7:0] is offset by 3.
val &= ~(0xFF << 3); // Clear previously set page number (if any)
val |= ((flash_page & 0xFF) << 3);

stlink_write_debug32(sl, STM32WB_FLASH_CR, val);
} else if (sl->flash_type == STLINK_FLASH_TYPE_G0) {
uint32_t flash_page = ((flashaddr - STM32_FLASH_BASE) / sl->flash_pgsz);
Expand Down

0 comments on commit 625f4cd

Please sign in to comment.