
UM10850
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2016. All rights reserved.
User manual
Rev. 2.4 — 13 September 2016
257 of 464
NXP Semiconductors
UM10850
Chapter 21: LPC5410x USARTs (USART0/1/2/3)
21.3 Basic configuration
If using the USARTs with FIFO support, configure the FIFOs, see
Configure USARTs for receiving and transmitting data:
•
In the ASYNCAPBCLKCTRL register, set bit 1 to 4 (
) to enable the clock to
the register interface.
•
Clear the USART0/1/2/3 peripheral resets using the ASYNCPRESETCTRL register
(
).
•
Enable or disable the USART0/1/2/3 interrupts in slots #17 to 20 in the NVIC.
•
Configure the USART0/1/2/3 pin functions via IOCON, see
•
Configure the USART clock and baud rate. See
•
Send and receive lines are connected to DMA request lines. See
.
Configure the USART0/1/2/3 to wake up the part from low power modes:
•
Configure the USART to receive and transmit data in synchronous slave mode. See
21.3.1 Configure the USART clock and baud rate
The USARTs share a common base clock, which can be adjusted by a fractional divider
(also see
Section 21.7.1.4 “32 kHz mode”
). The peripheral clock and the fractional divider
for the baud rate calculation are set up in the SYSCON block as follows (see
1. The Asynchronous APB clock must be configured via the ASYNCCLKDIV
register if it
has not already been set up. See
through
2. If a fractional value is needed to obtain a particular baud rate, program the fractional
rate divider (FRG, controlled by Syscon register FRGCTRL). The fractional divider
value is the fraction of MULT/DIV. The MULT and DIV values are programmed in the
FRGCTRL register. The DIV value must be programmed with the fixed value of 256.
USART clock = ASYNCCLKDIV / (1+(MULT / DIV))
The following rules apply for MULT and DIV:
–
Always set DIV to 256 by programming the FRGCTRL register with the value of
0xFF.
–
Set the MULT to any value between 0 and 255.
See
for more information on the FRG.
3. In asynchronous mode: For each USART, configure the baud rate divider BRGVAL in
that USART’s BRG register. The baud rate divider divides the common USART
peripheral clock to create the clock needed to produce the desired baud rate.
baud rate = U_PCLK / oversample rate x ( 1)
baud rate = U_PCLK / (1) x ( 1)
BRGVAL = (U_PCLK / 1) x baud rate) - 1
(assumes U_PCLK
≥
oversample rate x baud rate)
See
Section 21.6.9 “USART Baud Rate Generator register”
4. In synchronous master mode: The serial clock is Un_SCLK = U_PCLK / (1).