Follow the
high-level UNICOMM configurations in Section 22.3 before executing the below
UART-specific configurations.
To enable and
initialize the UART, perform the following initialization
steps:
- Clear the
ENABLE bit in the CTL0 register before making any
of the below configuration changes.
- Use the
baud-rate equation in Figure 23-4 to calculate the IBRD and FBRD
registers.
- Write the
integer portion of the BRD to the IBRD register.
- Write the
fractional portion of the BRD to the FBRD
register.
- Write the
desired communication mode settings to the CTL0
register (all CTL0 fields other than ENABLE).
- Write the
desired serial parameter configurations to the
LCRH register.
- Configure the desired FIFO trigger levels
in the IFLS register.
- Enable
desired interrupts and/or DMA event by using
CPU_INT, DMA_TRIG_RX, DMA_TRIG_TX group IMASK
registers.
- (Optionally) Configure the emulation mode for the
peripheral in the PDBGCTL register.
- Enable
the UART by setting the CTL0.ENABLE bit.
Note: Before
UNICOMM-UART is setup or configuration changes, the
CTL0.ENABLE bit must be cleared to avoid unpredictable
behavior during the updates or for the first data receive or
transmitted afterward.