cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB5MMG: Shutdown / Wakeup with PA0 button causes HardFault on wakeup

mdev
Visitor

Description

I am developing a system with STM32WB5MMG module.
A pushbutton is connected to PA0 and is used to control the system power state:

  • During runtime, PA0 works as an EXTI interrupt to request shutdown.

  • In shutdown mode, PA0 should act as the wakeup source.

System state before shutdown

  • At the moment the shutdown is requested, the system is fully initialized:

    • Both cores (M4 and M0+) are running,

    • The BLE stack is active and functional,

    • Clocks, peripherals, and services are all started.

  • Before calling the shutdown function, clocks and peripherals are stopped.

So the transition into shutdown happens from a stable and fully operational state.

Issue

  • Entering shutdown works as expected: the current consumption drops to nearly 0 µA.

  • Once the button is pressed to wake up:

    • Without the debugger, I can see consumption rises to about 3–4 mA, but the application does not start.

    • With the debugger connected, I can see the program counter and the system falls into the HardFault handler immediately after wakeup.

  • HardFault debug info:

    • PC = 0x1FFF1A3C

Is there a complete shutdown / wakeup example available for STM32WB5MMG that demonstrates this flow in a fully working system, including BLE initialization and operation?


Thank you.

1 REPLY 1
Fusion967
Visitor

Use PA0 as EXTI during runtime, then before shutdown clear its EXTI flag and configure it as a wakeup source in PWR. Note that wakeup from shutdown resets the MCU, so you must reinitialize cores and BLE stack after restart.