Closed P5pDev closed 12 months ago
Hi @P5pDev ,
Thank you for this report. We will get back to you as soon as we analyze it further. This may take some time. Thank you for your comprehension.
With regards,
ST Internal Reference: 149343
Fixed in commit 121e4039445ba59f284ebff013d8b3782d503e9f
Problem in https://github.com/STMicroelectronics/STM32CubeF3/blob/master/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c
Describe the set-up
Describe the bug Because of calling
HAL_FLASHEx_OBErase()
https://github.com/STMicroelectronics/STM32CubeF3/blob/e805a235c431db2e01cea47d795fa83d597c64af/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c#L679 theFLASH_OBR
register is reset and because of that theOB->WRPx
contains 0xffffThis means that the following instructions https://github.com/STMicroelectronics/STM32CubeF3/blob/e805a235c431db2e01cea47d795fa83d597c64af/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c#L687 https://github.com/STMicroelectronics/STM32CubeF3/blob/e805a235c431db2e01cea47d795fa83d597c64af/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c#L697 https://github.com/STMicroelectronics/STM32CubeF3/blob/e805a235c431db2e01cea47d795fa83d597c64af/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c#L707 https://github.com/STMicroelectronics/STM32CubeF3/blob/e805a235c431db2e01cea47d795fa83d597c64af/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c#L717 will always write 0xffff to the registers.
In my opinion, the solution would be
OB->WRPx &= WRPx_Data
instead, because theWriteProtectPage
was already initialized correctly : https://github.com/STMicroelectronics/STM32CubeF3/blob/e805a235c431db2e01cea47d795fa83d597c64af/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c#L649Please compare
FLASH_OB_EnableWRP()
: https://github.com/STMicroelectronics/STM32CubeF3/blob/e805a235c431db2e01cea47d795fa83d597c64af/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c#L519