We are working on STM32L476_NUCLEO board. We successfully entered and exit from STOP 2 mode upon RTC timer expiry. However, when we print a message after wake up, garbage is printed. Here is the code.
print ("Going to STOP 2 mode"); // Printed on console
USART2 -> CR1 |= 2;
/* Enter into STOP 2 Mode */
WRITE(0xE000ED10, READ(0xE000ED10) | 1<<2);
temp32 = READ32(PWR_CR1);
WRITE32(PWR_CR1, temp32 | PWR_CR1_LPMS_STOP2);
/* Successfully returned from STOP 2 mode */
USART2 -> CR1 &= ~2;
print ("\r\nBack"); // Funny characters are printed.