2025-07-16 12:29 AM
My simple program to test wake from standby with PC13/Wakeup_pin4 is working. I use the pushbutton on this pin as an EXTI and had to add the GPIO_DeInit before setting the pin as an input without EXTI.
The same code does not work in my larger program and I can't work out why??
printf("0 - sleep until button pressed\r\n");
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_13);
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN4);
PWR->WKUPCR = 0x3F; // Clear all wakeup flags (write 1 to clear)
PWREx_WakeupPinTypeDef sPinParams = {
.WakeUpPin = PWR_WAKEUP_PIN4,
.PinPolarity = PWR_PIN_POLARITY_HIGH,
.PinPull = PWR_PIN_NO_PULL
};
HAL_PWREx_EnableWakeUpPin(&sPinParams);
HAL_Delay(10);
HAL_TIM_Base_Stop_IT(&htim6);
HAL_SuspendTick();
BlinkOff();
HAL_PWR_EnterSTANDBYMode();
2025-07-16 2:43 AM
Hello @Ian_CP,
The most likely reason is wakeup pin configuration conflict, the pin PC13 is being used as an EXTI, enabled in another part of the program, it is interfering with the wakeup functionality.
This is the recommended sequence to follow
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.