2023-08-08 04:26 AM
please help me to solve this .My prototype is going to stand by but never waking up.I have used WKUP4 how i can assign interrupts for this .
void Enter_sleep(void)
{
//enable PWR control clock
__HAL_RCC_PWR_CLK_ENABLE();
// Set SLEEPDEEP bit of Cortex System Control Register
SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
//Select Standby mode
HAL_PWR_EnterSTANDBYMode();
//Clear wake up flag
if (__HAL_PWR_GET_FLAG(PWR_FLAG_WUF4) != RESET)
{
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF4);
}
//ENABLE WAKE UP PIN PA2 in this case
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN4_HIGH);
// Request wait for interrupt
__WFI();
}
Solved! Go to Solution.
2023-08-08 05:48 AM
Hello @meena,
You entered in Standby before configuring the WKUP pin. Try first to configure WKUP4, then run HAL_PWR_EnterSTANDBYMode();
Best Regards,
Gwénolé
2023-08-08 05:48 AM
Hello @meena,
You entered in Standby before configuring the WKUP pin. Try first to configure WKUP4, then run HAL_PWR_EnterSTANDBYMode();
Best Regards,
Gwénolé