STMicroelectronics / STM32CubeWB

Full Firmware Package for the STM32WB series: HAL+LL drivers, CMSIS, BSP, MW, plus a set of Projects (examples and demos) running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits).
https://www.st.com/en/embedded-software/stm32cubewb.html
Other
225 stars 138 forks source link

Failed to erase sectors when downloading the program for the first time #102

Open huangliguang opened 1 month ago

huangliguang commented 1 month ago

test STM32Cube_FW_WB_V1.19.0\Projects\P-NUCLEO-WB55.Nucleo\Examples\FLASH\FLASH_EraseProgram Failed to erase sectors when downloading the program for the first time After the debugger is reset, the erase is successful again, only the first erase of the downloaded program will fail

TOUNSTM commented 1 month ago

Hello @huangliguang,

First, we would like to thank you for your report.

We attempted to reproduce the issue you described using IAR 9.30.1 and STM32CubeIDE v1.14.0 compilers with STM32Cube_FW_WB_V1.19.0 and STM32Cube_FW_WB_V1.20.0 packages, but we were unable to replicate the problem.

Could you please provide more details about your setup, including Any modifications you made to the example project or any additional information that might help us understand the context better?

Thank you for your cooperation. kind regards,

huangliguang commented 1 month ago

Hello @huangliguang,

First, we would like to thank you for your report.

We attempted to reproduce the issue you described using IAR 9.30.1 and STM32CubeIDE v1.14.0 compilers with STM32Cube_FW_WB_V1.19.0 and STM32Cube_FW_WB_V1.20.0 packages, but we were unable to replicate the problem.

Could you please provide more details about your setup, including Any modifications you made to the example project or any additional information that might help us understand the context better?

Thank you for your cooperation. kind regards,

download and enter debug mode,erase sectors will be fail

TOUNSTM commented 1 month ago

Hello @huangliguang,

The STM32WB series microcontrollers support only page erase operations, not sector erase operations. The example provided in the STM32Cube_FW_WB_V1.19.0 package is configured to work properly with the FLASH_TYPEERASE_PAGES type erase. image

Kind regards,

JayToltTech commented 1 month ago

I think the confusion here is that the code in the samples refers to this as a sector erase but when you follow down into the logic it's actually performing page erases.

E.g. BLE_OTA flash_driver.c has functions named FD_EraseSingleSector, FD_EraseSectors, but these call into ProcessSingleFlashOperation which ends up using FLASH_TYPEERASE_PAGES.