Skip to main content
Remyhx
Associate III
January 28, 2025
Solved

STM32WB not responding to wakeup pin

  • January 28, 2025
  • 1 reply
  • 815 views

Hi,

Made a prototype board with a STM32WB55RGV. For testing the wake up I reduced to only UART1, incoming SYS WAKEUP PIN 4 (PA2), control LED on PB10, Serial Wire debugging. HSE/LSE present, but not used. BLE is not used, the firmware deleted, etc.

If I test by HAL_GPIO_ReadPin I can clearly detect Vcc on the Wake up pin (configured then as input) while pressing the button connected to this pin. Loosening falls down to 0/GND. A multimeter confirms 3.1V while pressing, 0V while loosening the button / in rest.

Just a simple code:

 

if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
{
 __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
}

HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN4);
HAL_Delay(1000);

HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN4_HIGH);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

HAL_PWR_EnterSTANDBYMode();

 

The device reaches standby mode, I notice the debugger lost contact after some seconds, pretty normal I guess. While pressing the button, confirming high level on PA2/SysWakeUp4 nothing happens. If I remove power and reapply, the program is just running until the enter standby function call. An LED confirms the start of the program.

I'm lost. Also changing PWR_WAKEUP_PIN4_HIGH to _LOW or the regular doesn't change the outcome. What am I missing here?

Screenshot 2025-01-28 at 13.02.17.png

Best answer by MorganLR

Hi,

Here is a code that worked for me (tested on an stm32wb15cc), based on the PWR_STANDBY_RTC example :

 

 if( (LL_PWR_IsActiveFlag_C1SB() == 0)
 || (LL_PWR_IsActiveFlag_C2SB() == 0)
 )
 {
 /* Set the lowest low-power mode for CPU2: shutdown mode */
 LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);
 }

 /* Enable pull down on wakeup pin PA2 */
 LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_2);

 /* Enable pull-up and pull-down configuration for CPU1 */
 LL_PWR_EnablePUPDCfg();

 /* Set wakeup pin polarity */
 LL_PWR_SetWakeUpPinPolarityHigh(LL_PWR_WAKEUP_PIN4);

 /* Enable wakeup pin */
 LL_PWR_EnableWakeUpPin(LL_PWR_WAKEUP_PIN4);

 /* As default User push-button (SW1) state is high level, need to clear all wake up Flag again */
 LL_PWR_ClearFlag_WU();


 /* Enter the Standby mode */
 HAL_PWR_EnterSTANDBYMode();

 

 Hope it helps

1 reply

MorganLRBest answer
Associate
January 28, 2025

Hi,

Here is a code that worked for me (tested on an stm32wb15cc), based on the PWR_STANDBY_RTC example :

 

 if( (LL_PWR_IsActiveFlag_C1SB() == 0)
 || (LL_PWR_IsActiveFlag_C2SB() == 0)
 )
 {
 /* Set the lowest low-power mode for CPU2: shutdown mode */
 LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);
 }

 /* Enable pull down on wakeup pin PA2 */
 LL_PWR_EnableGPIOPullDown(LL_PWR_GPIO_A, LL_PWR_GPIO_BIT_2);

 /* Enable pull-up and pull-down configuration for CPU1 */
 LL_PWR_EnablePUPDCfg();

 /* Set wakeup pin polarity */
 LL_PWR_SetWakeUpPinPolarityHigh(LL_PWR_WAKEUP_PIN4);

 /* Enable wakeup pin */
 LL_PWR_EnableWakeUpPin(LL_PWR_WAKEUP_PIN4);

 /* As default User push-button (SW1) state is high level, need to clear all wake up Flag again */
 LL_PWR_ClearFlag_WU();


 /* Enter the Standby mode */
 HAL_PWR_EnterSTANDBYMode();

 

 Hope it helps

Remyhx
RemyhxAuthor
Associate III
January 28, 2025

It works! I am so happy now... thank you so much!!