Understanding the Tiva UART

In here i will just give a quick introduction about the TM4C123GH6PM UART. It's the MCU in the TM4C123 launchpad.

It's a bit short, but there are allot of information around about the UART. There are very nice features in the Tiva about it but i will only use it for debugging so only the basic is needed.

There are allot of concepts that you won't know you haven't ever worked with a communication module or a UART module. I won't explain them all. Here are some links for explaining the generic UART protocol.

http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter

https://www.freebsd.org/doc/en/articles/serial-uart/

http://whatis.techtarget.com/definition/UART-Universal-Asynchronous-Receiver-Transmitter

Most of the explanations will be through the code examples so this will be just a bit of introduction.

What is UART

UART stand for Universal Asynchronous Receivers/Transmitters. It is a form of serial communication. The synchronized is by software, but it's called Asynchronous since it exists synchronized by hardware.

UART takes a 8bit paralel data and sends it by serial. The full packet is normally composed by 1 start bit, 8bits of data and 1 stop bit. There are other configurations.

You can see on the side that the UART has 2 signals. TX and RX. TX is the transmit signal, which sends data from the UART. RX is the receive signal from which the UART receives data. This is a basic UART configurations. You will see that the Tiva has more inputs/outputs for each UART.

Let's see the Tiva UART Features (taken from the tm4c123gh6pm datasheet)

The TM4C123GH6PM controller includes eight Universal Asynchronous Receiver/Transmitter (UART) with the following features:

  • Programmable baud-rate generator allowing speeds up to 5 Mbps for regular speed (divide by 16) and 10 Mbps for high speed (divide by 8)

  • Separate 16x8 transmit (TX) and receive (RX) FIFOs to reduce CPU interrupt service loading

  • Programmable FIFO length, including 1-byte deep operation providing conventional double-buffered interface

  • FIFO trigger levels of 1/8, 1/4, 1/2, 3/4, and 7/8

  • Standard asynchronous communication bits for start, stop, and parity

  • Line-break generation and detection

  • Fully programmable serial interface characteristics

    • 5, 6, 7, or 8 data bits

    • Even, odd, stick, or no-parity bit generation/detection

    • 1 or 2 stop bit generation

  • IrDA serial-IR (SIR) encoder/decoder providing

    • Programmable use of IrDA Serial Infrared (SIR) or UART input/output

    • Support of IrDA SIR encoder/decoder functions for data rates up to 115.2 Kbps half-duplex

    • Support of normal 3/16 and low-power (1.41-2.23 μs) bit durations

    • Programmable internal clock generator enabling division of reference clock by 1 to 256 for low-power mode bit duration

  • Support for communication with ISO 7816 smart cards

  • Modem flow control (on UART1)

  • EIA-485 9-bit support

  • Standard FIFO-level and End-of-Transmission interrupts

  • Efficient transfers using Micro Direct Memory Access Controller (μDMA)

    • Separate channels for transmit and receive

    • Receive single request asserted when data is in the FIFO; burst request asserted at programmed FIFO level

      • Transmit single request asserted when there is space in the FIFO; burst request asserted at programmed FIFO level

Well let's see some key features explained.

First of all the TM4C123GH6PM has 8 UART modules! In the launchpad you can use UART0 to communicate through the USB programming port into a COM. This is useful to debug data.

Baud Rate - Baud rate affects how fast you can send data. Baud rate is basically the frequency of the TX or RX pulses. So assuming a continuous data flow, the Baud rate value of 5Mbps means a Bit rate of 5Mbps. The Baud rate can be up to 10Mbps but when connecting to the computer COM you will see that this works differently and the max baud rate will be 115200.

Configurations - The data size can be configured to be from 5-8 bits. You can have different bit generation and 1 or 2 stop bits. For the typical use of UART0 in the launchpad with the USB port you should use 8bits, 1 stop bit and even bit generation. Of course if you configure you can configure your serial monitor for other configurations. Also there are some applications where you will need different UART configurations

FIFO - Well what is a FIFO. FIFO stands for First In First Out. It's a buffer that stores data and then sends it by order of entry, in this case through the UART.

The FIFO can store up to to 16 bytes and there is 1 for Transmitting other for Receiving.

They are most useful when using a more advanced feature that is the DMA, but even without the DMA they can be really useful. If you need to do a continuous transmission or receive, you would need the processor to keep loading each data 1 by 1. Well, with the FIFO you can load 16 at a time and then just come back when the FIFO is a bit emptied out, for the transmission FIFO, or a bit fuller, for the receive FIFO.

The FIFO can generate a interrupt when it's at 1/8, 1/4, 1/2, 3/4, and 7/8 of it's capacity so you don't have too program the processor to keep looking.

Well that it's.

As i said i will be explaining more through the codes.

I hope you liked it and goodbye.