cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB: CPU2 enters STOP with PESD=1 after Adv_Cancel, blocking CPU1 flash writes

Masco
Associate

Hello,

I’m working on a custom board with STM32WB15CC, dual-core mode with BLE stack.
I noticed an issue related to PESD (Program/Erase Suspend) when CPU2 enters STOP mode.

  • In my application, I call Adv_Cancel(); and this makes CPU2 enter STOP autonomously.

  • Then I call UTIL_LPM_EnterLowPower(); and CPU1 also goes to STOP correctly.

  • My application uses reduced wake cycles, and sometimes I do not restart advertising after wake-up (so CPU2 stays stopped).

  • Sporadically, in these reduced cycles, I see PESD=1 even though I am not accessing flash on CPU1.

  • This causes CPU1 to block in

     
    while(LL_FLASH_IsActiveFlag_OperationSuspended());

    inside ProcessSingleFlashOperation() in flash_driver.c (the official ST file for dual-core flash management with PESD).

The situation looks like CPU2 goes to STOP with flash still occupied (PESD set).
At that point, any flash write from CPU1 remains blocked forever.

At the moment, my only workaround is:

  • Before writing to flash, I check PESD, and

  • If PESD=1, I make BLE discoverable again to wake CPU2 and let it clear PESD.

This works, but it is not an optimal solution.

My question:
Is there a clear procedure to ensure that when I stop advertising and CPU2 goes to STOP autonomously, it does so without leaving PESD set?
In other words: how can I guarantee that CPU2 will always clear PESD before STOP, so CPU1 will never get stuck on flash writes?

Thank you!

0 REPLIES 0