2016-04-12 03:21 AM
Hi,
I am using STM32F7xx HAL Drivers v1.0.4 (09-December-2015). I found a bug in stm32f7xx_hal_flash.c : when I call HAL_FLASH_Program, and it returns an error (sector write protected for example), following calls to HAL_FLASH_Program return errors before any attempt to write. It is because error flags in FLASH_SR are not cleared after save. Here is a patch that fixes the bug in FLASH_WaitForLastOperation function : diff --git a/HAL_Driver/Src/stm32f7xx_hal_flash.c b/HAL_Driver/Src/stm32f7xx_hal_flash.c index 8ac6351..3de2461 100644 --- a/HAL_Driver/Src/stm32f7xx_hal_flash.c +++ b/HAL_Driver/Src/stm32f7xx_hal_flash.c @@ -646,6 +646,10 @@ HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout) { /*Save the error code*/ FLASH_SetErrorCode(); + + /*Clear error flags*/ + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_ERSERR ); + return HAL_ERROR; } -- 1.9.5.msysgit.02016-04-22 05:59 AM
Hi hanna.regis,
Thank you for bringing this issue to our attention. I will forward it to our development team for checking & come back to you. Sorry for the inconvenience may bring.-Syrine-