USART on STM32L486ZG doesn't send idle character every time.
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:
- Ungate USART clock.
- Configure parity and data word sizes in CR1 and CR2.
- Enable Rx interrupt.
- Set baudrate.
- Enable USART transmitter (Set TE bit in CR1).
- Enable USART (Set UE bit in CR1).
Sequence for turning USART OFF:
- Wait till transmitter is busy (Check TC bit in ISR register).
- Disable USART interrupts.
- Disable transmitter (Clear TE bit in CR1).
- Disable USART (Clear UE bit in CR1).
- Gate USART clocks.
Thanks,
Umair Khan