AnsweredAssumed Answered

USART on STM32L486ZG doesn't send idle character every time.

Question asked by Khan.Muhammad_Um.002 on Jan 2, 2017

Hello everyone,

I am facing problem with turning USART module ON and OFF. For the first time, when I turn USART ON, I receive an idle character on terminal (0xFF). Afterwards, on repeated ON/OFF, I receive different characters on terminal at 115200 baud rate. The TRM states that an idle frame (all ones) is transmitted everytime transmitter is enabled. But what I am seeing is not an all 1 character but something else. Can you help me out in finding out what it is? I am doing following sequence of operations for ON/OFF:
Sequence for turning USART ON:
  1. Ungate USART clock.
  2. Configure parity and data word sizes in CR1 and CR2.
  3. Enable Rx interrupt.
  4. Set baudrate.
  5. Enable USART transmitter (Set TE bit in CR1).
  6. Enable USART (Set UE bit in CR1).
Sequence for turning USART OFF:
  1. Wait till transmitter is busy (Check TC bit in ISR register).
  2. Disable USART interrupts.
  3. Disable transmitter (Clear TE bit in CR1).
  4. Disable USART (Clear UE bit in CR1).
  5. Gate USART clocks.
Umair Khan