English
Language : 

LM3S9B81 Datasheet, PDF (584/1155 Pages) Texas Instruments – Stellaris® LM3S9B81 Microcontroller
Universal Asynchronous Receivers/Transmitters (UARTs)
14.4
channel if a receive error occurs. If the DMAERR bit of the UARTDMACR register is set and a receive
error occurs, the DMA receive requests are automatically disabled. This error condition can be
cleared by clearing the appropriate UART error interrupt.
If DMA is enabled, then the μDMA controller triggers an interrupt when a transfer is complete. The
interrupt occurs on the UART interrupt vector. Therefore, if interrupts are used for UART operation
and DMA is enabled, the UART interrupt handler must be designed to handle the μDMA completion
interrupt.
See “Micro Direct Memory Access (μDMA)” on page 236 for more details about programming the
μDMA controller.
Initialization and Configuration
To enable and initialize the UART, the following steps are necessary:
1. The peripheral clock must be enabled by setting the UART0, UART1, or UART2 bits in the RCGC1
register (see page 174).
2. The clock to the appropriate GPIO module must be enabled via the RCGC2 register in the
System Control module (see page 183).
3. Set the GPIO AFSEL bits for the appropriate pins (see page 318). To determine which GPIOs to
configure, see Table 23-4 on page 1036.
4. Configure the GPIO current level and/or slew rate as specified for the mode selected (see
page 320 and page 328).
5. Configure the PMCn fields in the GPIOPCTL register to assign the UART signals to the appropriate
pins (see page 336 and Table 23-5 on page 1043).
To use the UARTs, the peripheral clock must be enabled by setting the UART0, UART1, or UART2
bits in the RCGC1 register (see page 174). In addition, the clock to the appropriate GPIO module
must be enabled via the RCGC2 register in the System Control module (see page 183). To find out
which GPIO port to enable, refer to Table 23-5 on page 1043.
This section discusses the steps that are required to use a UART module. For this example, the
UART clock is assumed to be 20 MHz, and the desired UART configuration is:
■ 115200 baud rate
■ Data length of 8 bits
■ One stop bit
■ No parity
■ FIFOs disabled
■ No interrupts
The first thing to consider when programming the UART is the baud-rate divisor (BRD), because
the UARTIBRD and UARTFBRD registers must be written before the UARTLCRH register. Using
the equation described in “Baud-Rate Generation” on page 577, the BRD can be calculated:
BRD = 20,000,000 / (16 * 115,200) = 10.8507
584
June 29, 2010
Texas Instruments-Advance Information