I'm trying to build battery device with periodic wakeup by internal RTC or By Button press. Most of all time device in StandBy mode. And I need to wake up every 2 seconds do to some thing and return to StandBy. But Device don't waking up every two seconds, only by Button (rissing edge on PA0-WKUP_PIN).
I'm trying to use code from hal test:
Code: Select all
palSetPadMode(GPIOA, GPIOA_WKUP, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOA, GPIOA_WKUP, PAL_MODE_UNCONNECTED);
/* set alarm in near future */
rtcSTM32GetSecMsec(&RTCD1, &tv_sec, NULL);
alarmspec.tv_sec = tv_sec + 2;
rtcSetAlarm(&RTCD1, 0, &alarmspec);
//DBGMCU->CR |= DBGMCU_CR_DBG_STANDBY;
PWR->CR = PWR_CR_CWUF | PWR_CR_CSBF | PWR_CR_PDDS | PWR_CR_LPDS;
PWR->CSR |= PWR_CSR_EWUP;
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
By pressing on Button connected to PA0 - device waking up. But don't waking up periodically.
What I do wrong?