Actions

EmSys

TM4C123G Launchpad UART Programming

From EdWiki

Revision as of 05:33, 5 June 2019 by Jshankar (Talk | contribs) (Created page with "__NOTOC__ == EK-TM4C123GXL Launchpad UART Programming == * Many of the TI ARM chips come with up to eight on-chip UART ports. They are designated as UART0 - UART7. * In the TI...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

EK-TM4C123GXL Launchpad UART Programming

  • Many of the TI ARM chips come with up to eight on-chip UART ports. They are designated as UART0 - UART7.
  • In the TI LaunchPad, the UART0 port of the TM4C123GH6PM is connected to the ICDI (In-Circuit Debug Interface), which is connected to a USB connector.
  • This ICDI USB connection contains three distinct functions:
    1. Programming (downloading) using LM Flash Programming software
    2. Debugging using JTAG (Stellaris In-Circuit Debug Interface)
    3. To use as a virtual COM port

Virtual COM Port

  • When the USB cable connects the Tiva LaunchPad, the device driver at the host PC establishes a virtual connection between the PC and the UART0 of the TM4C123GH6PM device.
  • On the LaunchPad, the connection appears as UART0.
  • On the host PC, it appears as a COM (/dev/ttyACM0) port and will work with communication software on the PC such as a terminal emulator (gtkterm, PuTTY, minicom, etc).
  • It is called a virtual connection because there is no need for an additional cable to make this connection.

UART Base Addresses

TI TM4C123GH6PM can have up to 8 UART ports. They are designated as UART0 to UART7. The following shows their Base addresses in the memory map

  • UART0 base: 0x4000.C000
  • UART1 base: 0x4000.D000
  • UART2 base: 0x4000.E000
  • UART3 base: 0x4000.F000
  • UART4 base: 0x4001.0000
  • UART5 base: 0x4001.1000
  • UART6 base: 0x4001.2000
  • UART7 base: 0x4001.3000

UART Registers Setup

There are many special function registers associated with each of the above UARTs. We will be using the UART0 as an example since a virtual connection is available on the TI Tiva LaunchPad.

Baudrate Generator (UARTIBRD)

Two registers are used to set the baud rate:

  • They are UART Integer Baud-Rate Divisor (UARTIBRD) and UART Fractional Baud-Rate Divisor (UARTFBRD).
  • Of the 32-bit of the UARTIBRD, only lower 16 bits are used and of the 32-bit of the UARTFBRD, only the lower 6 bits are used.
  • That gives us total of 22 bits (16 bits integer + 6 bits of fraction). To reduce the rate of error and use the standard baud rate, we should use both of the above divisor registers when we program the baud rate.