Nucleo-L433RC-P wake up from shutdown - wakes even though the switch is not pressed
I am trying to get shutdown and wakeup working using the blue top switch on the Nucleo-L433RC-P board.
I have set GPIO pin PC13 to SYS_WKUP2...

Below is my code...
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2);
while (1) {
status = HAL_GPIO_ReadPin(GPIOC, PWR_SWITCH_Pin);
if(status)
{
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN2);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2);
HAL_Delay(1000);
HAL_PWREx_EnterSHUTDOWNMode();
}
}
When I press the button, it goes into shutdown correctly.
However, as soon as its shutdown it wakes back up again (even though the button has not been pressed).
Why is this happening and how do I resolve it ?
