UART Function Documentation

 

Sys_UART_GPIOConfig

void Sys_UART_GPIOConfig(const UART_Type * uart, uint32_t cfg, uint32_t pad_tx, uint32_t pad_rx)

 

Configure two GPIOs for the specified UART interface.

 

Location: uart.h:52

 

Parameters

Direction Name Description

in

uart

Pointer to the UART instance

in

cfg

GPIO pin configuration for the UART pads

in

pad_tx

GPIO to use as the UART transmit pad

in

pad_rx

GPIO to use as the UART receive pad

 

 

Example Code for Sys_UART_GPIOConfig

    // Configure GPIOs 5 and 6 for the UART interface with

    // low-pass filter disabled, 8X drive-strength, and 1 kOhm pull-up resistors

    Sys_UART_GPIOConfig(UART, (GPIO_LPF_DISABLE | GPIO_1K_PULL_UP |

                       GPIO_8X_DRIVE), GPIO5GPIO6);

 

Sys_UART_Config

void Sys_UART_Config(UART_Type * uart, uint32_t uart_clk_hz, uint32_t baud, uint32_t config)

 

Configure and enable a UART interface.

 

Location: uart.h:80

 

Parameters

Direction Name Description

in

uart

Pointer to the UART instance

in

uart_clk_hz

UART clock speed in hertz

in

baud

Baud rate to which UART* is configured

in

config

DMA and interrupt mode enable; use UART_TX_DMA_[ENABLE | DISABLE] UART_RX_DMA_[ENABLE | DISABLE] UART_TX_INT_[ENABLE | DISABLE] UART_RX_INT_[ENABLE | DISABLE] UART_OVERRUN_INT_[ENABLE | DISABLE]

 

 

Example Code for Sys_UART_Config

    // Enable and Configure a UART:

    //  - 8 MHz clock speed

    //  - 9600 Hz baud rate

    //  - A TX DMA request is generated when new data is

    //    requested by the UART interface

    //  - An RX DMA request is generated when new data is

    //    received by the UART interface

    //  - Interrupts enabled

    Sys_UART_Config(UART, 8000000, 9600, (UART_TX_DMA_ENABLE |

                    UART_RX_DMA_ENABLE | UART_TX_START_INT_ENABLE |

                    UART_RX_INT_ENABLE | UART_OVERRUN_INT_ENABLE));