Clear error programming flags before erase & program operations

pull/8263/head
Juho Eskeli 2018-09-26 22:58:49 +03:00
parent ac6ca73dd8
commit 3a6b52fd15
1 changed files with 6 additions and 0 deletions

View File

@ -137,6 +137,9 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
return -1;
}
/* Clear error programming flags */
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS);
/* Clear OPTVERR bit set on virgin samples */
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
/* Get the 1st page to erase */
@ -194,6 +197,9 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
return -1;
}
/* Clear error programming flags */
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS);
/* Program the user Flash area word by word */
StartAddress = address;