cancel
Showing results for 
Search instead for 
Did you mean: 

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

mdev
Associate II

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.

3 REPLIES 3
Fusion967
Associate

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.

It's exactly what i'm doing.

HAL_NVIC_DisableIRQ(EXTI0_IRQn);
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0);

The procedure works, board goes into shutdown mode, then on the wake up is where i see the hard fault.

How to debug Hard Faults.

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.