This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/EK-TM4C123GXL: Tiva C TM-4C123GXL how to read/ write data in uart 1& uart 2& uart 3

Part Number: EK-TM4C123GXL

Tool/software: Code Composer Studio

Dear Experts,

now i am working with Tiva C TM-4C123GXL launch pad and uart echo example in TI-RTOS, this microcontroller have a many uart's but the example shows uart0 operation. how can i read and write data from other uart's like uart1, uart2...., 

only uart0 is defined in Board.h 

#define Board_UART0                 EK_TM4C123GXL_UART0

how can i define uart1, uart2 what changes can i do to in other headers for read data from other uart's 

Tiva C SDK version: tiva C V 2.16

CCS version 8

TI RTOS examples

if any one can share any example for read data from other uart's 

thank you.

  • Hello Surya,

    You would just need to follow the same process as UART0 for the other UART's, taking care to change the GPIO's associated with the ones for UART0.

    So you'd add do the follow:

    1. Add another UART to board.h
    2. In EK_TM4C1294XL.h, add the UART to the EK_TM4C1294XL_UARTName structure
    3. In EK_TM4C1294XL.c, you'd expand the UARTTiva_HWAttrs to include your new UART's, and add the right SysCtlPeripheralEnable and GPIO enables to EK_TM4C1294XL_initUART

    See the below as an example of how to expand the UARTTiva_HWAttrs to include UART1 as that portion may not be intuitive.

    /* UART configuration structure */
    const UARTTiva_HWAttrs uartTivaHWAttrs[EK_TM4C1294XL_UARTCOUNT] = {
        {
            .baseAddr = UART0_BASE,
            .intNum = INT_UART0,
            .intPriority = (~0),
            .flowControl = UART_FLOWCONTROL_NONE,
            .ringBufPtr  = uartTivaRingBuffer[0],
            .ringBufSize = sizeof(uartTivaRingBuffer[0])
        },
        {
            .baseAddr = UART1_BASE,
            .intNum = INT_UART1,
            .intPriority = (~0),
            .flowControl = UART_FLOWCONTROL_NONE,
            .ringBufPtr  = uartTivaRingBuffer[1],
            .ringBufSize = sizeof(uartTivaRingBuffer[1])
        }
    };