STM32WB55 - Stuck waiting for FLASH_FLAG_CFGBSY during OTA update & running FreeRTOS
- January 1, 2025
- 3 replies
- 1430 views
Hi Everyone,
I'm using the P-NUCLEO-WB55 board and seeing an an issue when attempting an OTA firmware using the STBLESensorClassic mobile app running on iOS device. Execution is blocked waiting for the "FLASH_FLAG_CFGBSY" to clear in FLASH_WaitForLastOperation() in stm32wbxx_hal_flash.c. Please see screenshot below of call stack and location.
Setup
CubeIDE v1.14.1
STM32Cube_FW_WB_V1.21.0
ST BLE Sensor Classic 4.20.1
Background
If I use the out of the box OTA example "BLE_Ota" on the P-NUCLEO-WB55 board the OTA update works fine. However, this example uses the sequencer which is not representative of our end application. We are using FreeRTOS in our end application. In an effort to create an application that is somewhat representative of our end application I've combined/merged the "BLE_Ota" & "BLE_HeartRateFreeRTOS" examples into a single project. With this merged project running on the P-NUCLEO-WB55 board the issue is reproducible. I've attached the project to this thread. The BLE_HeartRateFreeRTOS uses timer 17 for the FreeRTOS time source unlike the BLE_Ota/sequencer example which uses systick.
There are some old posts about similar issues like this one https://forums.freertos.org/t/stm32wb55-flash-sr-cfgbsy-never-clears-when-using-freertos-and-tim1/12300/15 that refer to interrupts firing before the timer instance is initialized. Their solution was to add a NULL guard around the HAL_TIM_IRQHandler(). I've tried this but the issue persists.
I appreciate any input you can provide.
Thanks,

