Question
Exiting STOP mode on USART character
Posted on August 30, 2013 at 14:27
Hi, I have a bit of an issue - I'm trying to put an STM32 into STOP mode, but to have it wake up when a character is sent over the USART (and to receive that character).
My code is just:// .. set up an EXTI for the USART RX pin
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
// disable EXTI for the USART RX pin and swap it back to the USART
RCC_HSEConfig(RCC_HSE_ON);
if
( RCC_WaitForHSEStartUp() == SUCCESS) {
RCC_PLLCmd(ENABLE);
while
(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
while
(RCC_GetSYSCLKSource() != 0x08);
}
However the character that is received is corrupted. My guess is that maybe the HSE/PLL takes too long to start up, and so the USART is being clocked too slowly initially.
The serial data is coming in at 9600 baud so I hoped that there would be enough time for everything to get up to speed though. Any ideas? This seems like a common thing to want to do.
#stm32-usart-stop-sleep