Question
Unable to wake-up from stand-by using pin wake-up
Hello,
I'm using STM32F779NI.
I'm trying to enter Standby mode & would like to wake-up through pin wake-up (PC13).
Looks like stand-by entry is happening fine (SBF is set post reset) but wake-up pin flag is not set.
Please find the code as below
int main(void)
{
/* Add your application code here */
__IO uint32_t tmpreg;
/* Enable clock for toggle LED */
SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);
tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);
/* Enable clock for toggle LED */
SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);
tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);
/* Enable clock for PWR module */
SET_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);
tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);
/* Configure toggle LED */
GPIOI->MODER |= GPIO_MODER_MODER15_0;
GPIOI->PUPDR |= GPIO_PUPDR_PUPDR15_0;
GPIOI->OSPEEDR |= GPIO_OSPEEDR_OSPEEDR15;
GPIOI->BSRR= GPIO_BSRR_BS15; // Reset
/* Configure toggle LED 1 */
GPIOJ->MODER |= GPIO_MODER_MODER0_0;
GPIOJ->PUPDR |= GPIO_PUPDR_PUPDR0_0;
GPIOJ->OSPEEDR |= GPIO_OSPEEDR_OSPEEDR0;
GPIOJ->BSRR= GPIO_BSRR_BS0; // Reset
if( (READ_BIT(PWR->CSR1,PWR_CSR1_SBF)) == PWR_CSR1_SBF)
{
GPIOI->BSRR= GPIO_BSRR_BR15; // Set
if( (READ_BIT(PWR->CSR2,PWR_CSR2_WUPF4)) == PWR_CSR2_WUPF4)
{
GPIOJ->BSRR= GPIO_BSRR_BR0; // Set
}
}
/* Set SLEEPDEEP bit of Cortex System Control Register */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* Enable standby mode */
SET_BIT(PWR->CR1, PWR_CR1_PDDS);
// Clear WUF flag
SET_BIT(PWR->CR2, PWR_CR2_CWUPF4);
// Enable appropriate wake-up pin
SET_BIT(PWR->CR2, PWR_CR2_WUPP4);
SET_BIT(PWR->CSR2, PWR_CSR2_EWUP4);
/* Ensure that all instructions done before entering SLEEP mode */
__DSB();
__ISB();
/* Request Wait For Interrupt */
__WFI();
}Regards,
Bivin