Skip to main content
Graduate II
February 24, 2025
Question

HAL_PWR_DisableWakeUpPin API not working as expected

  • February 24, 2025
  • 2 replies
  • 535 views

Hi,

 

I am working on STM32WB55RG MCU and I wanted to enable one pin for Wakeup from Shutdown mode. That works fine.

 

But, when another EXTI pin is initialized, I am not able to disable it. The MCU wakes up when this pin (connector) state is changed, even while it is disabled using the HAP API. 

 

In the code below, I want to enable wakeup for PIN1, which is a switch. But disable PIN4. 

 

bool LowPower_EnterShutdownMode(void)
{
	HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN4);

	HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1_LOW);
	HAL_PWREx_EnterSHUTDOWNMode();

	NVIC_SystemReset();
}

 

 

it also does not work when all the rest of the pins are made analog as well.

NRedd2_0-1740406344371.png

 

 

#define STAT_Pin GPIO_PIN_4
#define STAT_GPIO_Port GPIOE

#define USR_BTN_Pin GPIO_PIN_0
#define USR_BTN_GPIO_Port GPIOA 

/*Configure GPIO pin : PtPin */
 GPIO_InitStruct.Pin = USR_BTN_Pin;
 GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
 GPIO_InitStruct.Pull = GPIO_NOPULL;
 HAL_GPIO_Init(USR_BTN_GPIO_Port, &GPIO_InitStruct);

 /*Configure GPIO pin : PtPin */
 GPIO_InitStruct.Pin = STAT_Pin;
 GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
 GPIO_InitStruct.Pull = GPIO_NOPULL;
 HAL_GPIO_Init(STAT_GPIO_Port, &GPIO_InitStruct);

 

 

Am I missing something here? 

 

Best regards,

Navin

    This topic has been closed for replies.

    2 replies

    Super User
    February 24, 2025

    What is keeping the pin at a known state to prevent noise from triggering it? Has to be a pullup or pulldown somewhere.

     

    > it also does not work when all the rest of the pins are made analog as well.

    So when you make other pins analog, pin 1 doesn't cause a wakeup any more? That doesn't quite add up. Sure you're not overwriting the pin 1 configuration somewhere in there?

    NRedd.2Author
    Graduate II
    February 24, 2025

    Hello @TDK,

    Thank you for the response. 

    What is keeping the pin at a known state to prevent noise from triggering it? Has to be a pullup or pulldown somewhere.

    For the pin we want the device to wake-up, it is connected to a button.

    For, the pin that we do not want to wake up, it is pulled up. This is the pin that needs to be disabled from wake-up. This pin is connected to the charger ACOK (input power detection). 

     

    So when you make other pins analog, pin 1 doesn't cause a wakeup any more? That doesn't quite add up. Sure you're not overwriting the pin 1 configuration somewhere in there?

    Sorry, I was not clear. When I made pin 4 analog as well, the MCU was still waking up from sleep.

    Super User
    February 24, 2025

    > For the pin we want the device to wake-up, it is connected to a button.

    It needs a pullup or pulldown to be at a known state. Just a button won't do. You can use the internal pullup if they can be active in shutdown mode. Not sure if that's possible or not, but the reference manual would let you know.

    NRedd.2Author
    Graduate II
    February 26, 2025

    Hello @TDK,

     

    I can confirm that the button is pulled down. The issue that we are facing is being unable to disable the ACOK pin as wake-up source.