Clear the ENABLE bit before setup to
avoid unpredictable behavior:
Use the following steps to configure
and enable the UART:
- 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 12.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.