2021-07-14 11:00 PM
Hi,
I am using STM32L073RZT6 board, i am use the wakeup pin PA0 and PC13 together on the standby mode but in the standby mode, PA0 wakeup pin is not working. I am enable both the pin before go to standby mode. The power Control Status Register are
PA0 = PWR_CSR_EWUP1 and PC13 = PWR_CSR_EWUP2.
Piece of code to enable the wakeup pin and go to standby mode:
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
PWR->CSR &= ~PWR_CSR_EWUP2;
PWR->CSR &= ~PWR_CSR_EWUP1;
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
PWR->CSR |= PWR_CSR_EWUP2;
PWR->CSR |= PWR_CSR_EWUP1;
PWR->CR |= PWR_CR_CWUF;
PWR->CR |= PWR_CR_ULP;
HAL_PWR_EnterSTANDBYMode();
/*Standby Defination*/
void HAL_PWR_EnterSTANDBYMode(void)
{
/* Select Standby mode */
SET_BIT(PWR->CR, PWR_CR_PDDS);
/* Set SLEEPDEEP bit of Cortex System Control Register */
SET_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk);
SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;
/* This option is used to ensure that store operations are completed */
#if defined ( __CC_ARM)
__force_stores();
#endif
/* Request Wait For Interrupt */
__WFI();
}
Thank You