Stm32F103 standby problems
Posted: Sun Nov 03, 2013 7:00 pm
Hey guys,
I experience problems when trying to enter the standby mode and waking up after a few seconds again with a custom STM32F103C8 board.
I took the code from the testhal/RTC example and used it in a simple application:
I would expect the debug pin to be periodically high for about one second and low for about 5 seconds.
What happens is that it is high for 1 second and then stays low. The chip seems to go asleep but never returns.
The RTC is clocked by LSI. Any ideas what is going wrong here?
I experience problems when trying to enter the standby mode and waking up after a few seconds again with a custom STM32F103C8 board.
I took the code from the testhal/RTC example and used it in a simple application:
Code: Select all
int main(void)
{
halInit();
chSysInit();
palSetPadMode(PORT_DBG, PIN_DBG, PAL_MODE_OUTPUT_PUSHPULL); //DEBUG
palSetPad(PORT_DBG, PIN_DBG);
//wait some time
chThdSleepMilliseconds(1000);
palClearPad(PORT_DBG, PIN_DBG);
//set RTC wakeup
rtcGetTime(&RTCD1, ×pec);
alarmspec.tv_sec = timespec.tv_sec + 5; //standby for 5 seconds
rtcSetAlarm(&RTCD1, 0, &alarmspec);
//enter standby mode
chSysLock();
PWR->CR |= (PWR_CR_PDDS | PWR_CR_LPDS | PWR_CR_CSBF | PWR_CR_CWUF);
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
__WFI();
return 0;
}
I would expect the debug pin to be periodically high for about one second and low for about 5 seconds.
What happens is that it is high for 1 second and then stays low. The chip seems to go asleep but never returns.
The RTC is clocked by LSI. Any ideas what is going wrong here?