The UART module provides four I/O signals to be routed to the DIOs. The following signals are selected through the IOCFGn registers in the IOC module.
- Inputs: RXD, CTS
- Outputs: TXD, RTS
CTS and RTS lines are active low.
Note: IOC must be configured before enabling the UART to avoid unwanted transitions on the input being processed as UART signals. When IOC is configured as UART-specific I/Os (RXD, CTS, TXD, or RTS), IOC sets static output driver enable to the DIO (output driver enable = 1 for output TXD and RTS and output driver enable = 0 for inputs RXD and CTS).
The following describes the necessary steps to enable and initialize the UART.
TI recommends using the UART2 driver in the SimpleLink™ CC13xx and CC26xx software development kit (SDK) when using the UART.
- Enable the serial power domain and enable the UART module in the PRCM module by writing to the PRCM:UARTCLKGR register, the PRCM:UARTCLKGS register, and the PRCM:UARTCLKGDS register, and loading the setting to the clock controller by writing to the PRCM:CLKLOADCTL register
- Configure the IOC module to map UART signals to the correct GPIO pins. For more information on pin connections, see Chapter 400.
This section discusses the steps required to use a UART module. For this example, the UART clock is assumed to be 24 MHz, and the desired UART configuration is the following:
- Baud rate: 115200
- 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 BRD because the UART:IBRD and UART:FBRD registers must be written before the UART:LCRH register. The BRD can be calculated using the equation described in Section 22.4.2.
Equation 6. BRD = 24 000 000 / (16 × 115 200) = 13.0208
The result of Equation 6 indicates that the UART:IBRD.DIVINT field must be set to 13 decimal or 0xD. Equation 7 calculates the value to be loaded into the UART:FBRD register.
Equation 7. UART:FBRD.DIVFRAC = integer (0.0208 × 64 + 0.5) = 1
With the BRD values available, the UART configuration is written to the module in the following order:
- Disable the UART by clearing the UART:CTL.UARTEN bit.
- Write the integer portion of the BRD to the UART:IBRD register.
- Write the fractional portion of the BRD to the UART:FBRD register.
- Write the desired serial parameters to the UART:LCRH register (in this case, a value of 0x00000060).
- Enable the UART by setting the UART:CTL.UARTEN bit.