Merge pull request #8263 from juhoeskeli/flash_api_stm32l4

STM32L4: clear error programming flags before erase & program operations
pull/8192/merge
Martin Kojtal 2018-10-09 10:33:50 -05:00 committed by GitHub
commit 17762b4998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -137,8 +137,9 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
return -1;
}
/* Clear OPTVERR bit set on virgin samples */
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
/* Clear error programming flags */
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS);
/* Get the 1st page to erase */
FirstPage = GetPage(address);
/* MBED HAL erases 1 page / sector at a time */
@ -194,6 +195,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;