Skip to main content
H UQ
Associate II
June 4, 2018
Question

Garbage Printing after wake up from STOP 2 mode - stm32l476rg

  • June 4, 2018
  • 2 replies
  • 1208 views
Posted on June 04, 2018 at 09:21

Hi, 

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);

WFI_EXECUTE();

WRITE(

0xE000ED10,

0

);

WRITE(PWR_CR1, temp32);

/* Successfully returned from STOP 2 mode */

USART2 -> CR1 &=  ~2;

print ('\r\nBack'); // Funny characters are printed. 

Regards

#stm32l476 #stop-mode-2 #nucleo-stm
This topic has been closed for replies.

2 replies

Uwe Bonnes
Chief
June 4, 2018
Posted on June 04, 2018 at 10:20

Probably UART TX has no external pull-up. When in sleep, internal pull-up is switched off, TX goes ow and when woken up TX goes to 1 again, indication a start condition, resulting in a nonsens character received.

Tesla DeLorean
Guru
June 4, 2018
Posted on June 04, 2018 at 12:58

That, or the part is operating with a different clocking regime when it comes back, and you either need to restore the original clocking, or adjust the UART->BRR to reflect new divisors for the baud rate.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
H UQ
H UQAuthor
Associate II
June 4, 2018
Posted on June 04, 2018 at 13:02

I checked my RCC settings before and after STOP Mode 2. It is same. We are using HSI clcok. Probably, some bit not in RCC is slipped after exiting from STOP mode. 

Tesla DeLorean
Guru
June 4, 2018
Posted on June 04, 2018 at 13:05

Suggest you output 'U' character stream and scope it to confirm bit timing if you see incorrect data. Check the clock source selected for the USART

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..