UART Driver

The UART header file should be included in an application as follows:

The uart/include/reg_sci.h has the register layer definitons for the UART SCI Module.

Link Requirements

The UART driver interface module is joined (at link time) to a NULL-terminated array of UART_Config data structures named UART_config. UART_config is implemented in the application with each entry being an instance of a UART peripheral. Each entry in UART_config contains a:

There is a platform specific UART file present in the ti/drivers/uart/platform directory. This file is built as a part of the UART Library for the specific platform.

Opening the driver

UART_Handle handle;
UART_Params params;
params.baudRate = someNewBaudRate;
handle = UART_open(someUART_configIndexValue, &params);
if (!handle) {
// Error: Unable to open the UART
}

Writing data

const unsigned char hello[] = "Hello World\n";
ret = UART_write(handle, hello, sizeof(hello));

Reading data

unsigned char rxBuffer[20];
ret = UART_read(handle, rxBuffer, sizeof(rxBuffer));

DMA Interface

The UART driver can be hooked up with the DMA (MSS)/EDMA (DSS). In this case case the read & write operations are done using the DMA/EDMA blocks. This would make the UART driver require the DMA or EDMA drivers. On memory constrained system this might not be acceptable; in which case the driver also provides a default no-DMA layer. In order to use this please modify the hardware attributes 'gUartSciHwCfg' defined in the platform specific file and replace the DMA functions with the no-DMA variants.

See also
UartSci_noDMAIsDMAEnabled UartSci_noDMAOpen UartSci_noDMAClose UartSci_noDMAInitiateRxDMA UartSci_noDMAInitiateTxDMA

Please rebuild the driver after this modification.

While using the DMA interface in the read mode please be aware that the function UART_read/UART_readPolling always operate in UART_RETURN_FULL mode.


Copyright 2018, Texas Instruments Incorporated