AnsweredAssumed Answered

bug: STM32Cube, flash operation

Question asked by Holfert.Jan on Oct 10, 2016
Latest reply on Oct 13, 2016 by Holfert.Jan
Dear all,

using the flash and option byte functions from STM32CubeF4 (MCU: STM32F469) I am concerned about its implementation.

Does anyone from ST may check the following code:

1)
stm32f4xx_hal_flash.c: line 592 - 598, function "FLASH_WaitForLastOperation"

if(__HAL_FLASH_GET_FLAG((FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \
FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR | FLASH_FLAG_RDERR)) != RESET)
{
/*Save the error code*/
     FLASH_SetErrorCode();
     return HAL_ERROR;
}

If not all error flags are set, the if-clause is false. Is this your intention?



2)
stm32f4xx_hal_flash_ex.h: line 479

#define OB_WRP_SECTOR_All     ((uint32_t)0x00000FFFU << 12) /*!< Write protection of all Sectors */

Why do you say "All" and respect only sectors 12 to 23?



3)
The nested if-clause with all its "and" and "or"s in functions "FLASH_OB_EnableWRP" and "FLASH_OB_DisableWRP".
I don't understand the intention of this if-clause. It seems to be terribly broken. By the way, the bank information is already in the sector mask. Why this redundancy?


Best regards,
sphere

Outcomes