cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 - Stuck waiting for FLASH_FLAG_CFGBSY during OTA update & running FreeRTOS

chris24
Associate II

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,

 

chris24_0-1735767129032.png

 

10 REPLIES 10

Thanks Christophe, I’ve made some progress on this topic over the past few days. I realized that I had disabled the IWDG initialization call in debug mode, but not the periodic refresh calls. As a result, the refresh was being called on an uninitialized hiwdg (0x00000000?). That was most likely the issue.

I haven’t encountered the problem again since making that change. I hope that was truly the root cause! Time will tell…