Before the UART is setup or configuration changes, the ENABLE bit should be cleared to avoid unpredictable behavior during the updates or for the first data receive or transmitted afterward.
To enable and initialize the UART, use the following steps:
- Configure RX and TX pin functions by using the IOMUX registers.
- Reset the peripheral using UARTx.RSTCTL register
- Enable the power to UART peripheral using the UARTx.PWREN register
- Select the UART function clock source and divide options using UART.CLKSEL and UART.CLKDIV registers.
- Disable the UART by clearing the UART.CTL0.ENABLE bit.
- Use the baud-rate equation in Section 11.2.3.4 to calculate the UARTx.IBRD and UARTx.FBRD registers.
- 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 oversampling and FIFO configuration to the UART.CTL0 register
- Write the desired serial parameters to the UART.LCRH register.
- Enable the UART by setting the UART.CTL0.ENABLE bit.