cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_PWR_DisableWakeUpPin API not working as expected

NRedd.2
Associate III

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

2 REPLIES 2
TDK
Guru

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?

If you feel a post has answered your question, please click "Accept as Solution".
NRedd.2
Associate III

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.