AnsweredAssumed Answered

STM32 sleep mode

Question asked by kuznetsov.vladim.001 on May 23, 2013
There's question about sleep mode for STM32F103. When I tried to use STOP mode with event wakeup (WFE) and AWU timer, clocking from LSI, and it was needed to control CAN-bus and USART1 at the same time.
Could you help me with example of how to fastly wake up from this mode? When I clock the HSE and wait for its stable flags and running other parts of the system, I miss 1-2 packets from CAN and some data from USART too.

Another question is how to recognize the wake-up source? In WFE mode my system can wakeup from EXTI event (I control USART_RX and CAN_RX pins to wakeup) and RTC_Alarm event. But after woking up I cannot get any info about the wakeup source - some pins (on high-speed CAN, for example) already could change it's state, so, I cannot control them. Any event-flags are un-informative.
There was one solution - for RTC Alarm, but it works unstable - I tried to compare desired Alarm-time and current time and if they are not equal - this means that wakeup was from EXTI... But it's not right I think...
Any suggestions?