Texas Instruments CC2650DK Manuel D’Utilisation
UARTS Registers
To enable and initialize the UART, use the following steps:
1. Enable the serial power domain and enable the UART module in the PRCM module by writing to the
[PRCM_UARTCLKGR], [PRCM_UARTCLKGS], and [PRCM_UARTCLKGDS] registers, or by using the
driver library functions:
driver library functions:
PRCMPeripheralRunEnable(uint32_t), PRCMPeripheralSleepEnable(uint32_t),
PRCMPeripheralDeepSleepEnable(unit32_t)
and loading the setting to the clock controller by writing to the [PRCM_CLKLOADCTL] register or by
using the function
using the function
PRCMLoadSet().
2. Configure the IOC module to map UART signals to the correct GPIO pins. For more information on pin
connections, see
, I/O Control chapter.
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:
assumed to be 24 MHz, and the desired UART configuration is:
•
115 200 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 BRD, because the [UART_IBRD] and
[UART_FBRD] registers must be written before the [UART_LCRH] register. Using the equation described
in
[UART_FBRD] registers must be written before the [UART_LCRH] register. Using the equation described
in
, the BRD can be calculated:
BRD = 24 000 000 / (16 × 115 200) = 13.0208
(3)
which means that the DIVINT field of the [UART_IBRD] register should be set to 13 decimal or 0xD. The
value to be loaded into the [UART_FBRD] register is calculated by the equation:
value to be loaded into the [UART_FBRD] register is calculated by the equation:
UART_FBRD.DIVFRAC = integer(0.0208 × 64 + 0.5) = 1
(4)
With the BRD values available, the UART configuration is written to the module in the following order:
1. Disable the UART by clearing the UARTEN bit in the [UART_CTL] register.
2. Write the integer portion of the BRD to the [UART_IBRD] register.
3. Write the fractional portion of the BRD to the [UART_FBRD] register.
4. Write the desired serial parameters to the [UART_LCRH] register (in this case, a value of 0x0000
0060).
5. Enable the UART by setting the UARTEN bit in the [UART_CTL] register.
19.7 UARTS Registers
1335
SWCU117A – February 2015 – Revised March 2015
Universal Asynchronous Receivers and Transmitters (UARTS)
Copyright © 2015, Texas Instruments Incorporated