cancel
Showing results for 
Search instead for 
Did you mean: 

Flash Erase Operation Stuck During BLE Scanning on STM32WB55

xz_zk
Associate II

Dear ST Support,

I am using the STM32WB55 series and have encountered an issue where the Flash erase operation gets stuck when BLE scanning is active. Specifically, the Flash erase call (SHCI_C2_FLASH_EraseActivity(ERASE_ACTIVITY_ON)) does not proceed as long as the BLE scan procedure is running, even if the scan interval and window are configured with minimal values (e.g., SCAN_P = 0x320 and SCAN_L = 0x10). It seems that as long as BLE scanning is ongoing, the Flash operation remains blocked.

From my understanding, the BLE stack on the M0 core occupies some resources during the scan procedure, and Flash operations are blocked until all BLE activities are terminated. This behavior persists even when BLE is only actively scanning for a small portion of the interval.

Could you please clarify:

  1. Is it expected that Flash erase/write operations cannot be performed during any ongoing BLE activity, regardless of scan interval/window settings?
  2. Is there a recommended method to safely perform Flash operations when BLE scanning is required, without stopping BLE completely?

Thank you for your support.

1 ACCEPTED SOLUTION

Accepted Solutions
EMECH
ST Employee

Hi,
It is recommended to manage the FLASH accesses under a scheduler task.
You can see an example of FLASH management with RF activity in the stm32wb_M4_Firmware\Firmware\Projects\P-NUCLEO-WB55.Nucleo\BLE_RfWithFlash.
Let me know if it helps you.

Best regards.

View solution in original post

5 REPLIES 5
EMECH
ST Employee

Hi,

On STM32WB MCUs to execute the erase operation when BLE is running, the application must ensure that there is a radio idle time longer than 25 ms.
For more details please refer to the chapter "4.7.3 Conflict between RF activity and flash memory management" of the AN5289 Application note How to build wireless applications with STM32WB MCUs.

Best regards.


Dear EMECH,

Thank you very much for your support.

According to the recommendations in the AN5289 document, I have set the BLE scan interval to 500ms and the scan window to 10ms. Specifically, I am using the following API call:

result = aci_gap_start_general_discovery_proc(0x640, 0x10, CFG_BLE_ADDRESS_TYPE, 1);
As I understand it, this configuration should provide 490ms of RF idle time, which is much greater than the required 25ms. However, in practice, I am still experiencing issues where the Flash erase operation cannot be performed.

Could you please advise on possible reasons for this issue under these settings? Are there any other configurations or specific APIs that need to be called to ensure the RF is completely idle during the Flash erase operation?
If you have any best practices or recommended procedures for reliably performing Flash erase, I would greatly appreciate your sharing them.

Thank you again for your valuable time and assistance.

Best regards.

EMECH
ST Employee

Hi,
It is recommended to manage the FLASH accesses under a scheduler task.
You can see an example of FLASH management with RF activity in the stm32wb_M4_Firmware\Firmware\Projects\P-NUCLEO-WB55.Nucleo\BLE_RfWithFlash.
Let me know if it helps you.

Best regards.

Hi,

Thank you for your suggestion.
I have checked the BLE_RfWithFlash example, and managing FLASH accesses under a scheduler task solved my problem.
Your advice was very helpful.

Best regards.

EMECH
ST Employee

Hi,

You're welcome.

Best regards.