In single-wire mode, the UART_C3[TXDIR] bit controls the direction of serial data on
the UART_TX pin. When UART_C3[TXDIR] is cleared, the UART_TX pin is an input
to the UART receiver and the transmitter is temporarily disconnected from the
UART_TX pin so an external device can send serial data to the receiver. When
UART_C3[TXDIR] is set, the UART_TXD pin is an output driven by the transmitter, the
internal loop back connection is disabled, and as a result the receiver cannot receive
characters that are sent out by the transmitter.
31.3.5 Interrupts and status flags
The UART system generates three separate interrupts to reduce the amount of software
needed to isolate the cause of the interrupt. One interrupt is associated with the
transmitter for TDRE and TC events. Another interrupt is associated with the receiver for
RDRF, IDLE, RXEDGIF, and LBKDIF events. A third interrupt is used for OR, NF, FE,
and PF error conditions. Each of these ten interrupt sources can be separately masked by
local interrupt enable masks. The flags can be polled by software when the local masks
are cleared to disable generation of hardware interrupt requests.
The UART transmitter has two status flags that can optionally generate hardware
interrupt requests. Transmit data register empty (UART_S1[TDRE]) indicates when there
is room in the transmit data buffer to write another transmit character to UART_D. If the
transmit interrupt enable (UART_C2[TIE]) bit is set, a hardware interrupt is requested
when UART_S1[TDRE] is set. Transmit complete (UART_S1[TC]) indicates that the
transmitter is finished transmitting all data, preamble, and break characters and is idle
with UART_TX at the inactive level. This flag is often used in systems with modems to
determine when it is safe to turn off the modem. If the transmit complete interrupt enable
(UART_C2[TCIE]) bit is set, a hardware interrupt is requested when UART_S1[TC] is
set. Instead of hardware interrupts, software polling may be used to monitor the
UART_S1[TDRE] and UART_S1[TC] status flags if the corresponding UART_C2[TIE]
or UART_C2[TCIE] local interrupt masks are cleared.
When a program detects that the receive data register is full (UART_S1[RDRF] = 1), it
gets the data from the receive data register by reading UART_D. The UART_S1[RDRF]
flag is cleared by reading UART_D.
The IDLE status flag includes logic that prevents it from getting set repeatedly when the
UART_RX line remains idle for an extended period of time. IDLE is cleared by writing 1
to the UART_S1[IDLE] flag. After UART_S1[IDLE] has been cleared, it cannot become
set again until the receiver has received at least one new character and has set
UART_S1[RDRF].
Chapter 31 Universal Asynchronous Receiver/Transmitter (UART0)
KL02 Sub-Family Reference Manual, Rev. 2.1, July 2013
Freescale Semiconductor, Inc.
519