• Resolved

RTOS/EK-TM4C123GXL: UART_read() to receive data continuously.

Part Number: EK-TM4C123GXL

Tool/software: TI-RTOS

Hello,

I am working on interfacing multiple sensors to TM4C123G microcontroller and read the data via UART and store it in a buffer and transmit the same via USB interface. I am facing issues in reading the data via UART, it just returns nothing when I try to read and blocks my next statements. Following is a snippet of the code,

Void echoFxn(UArg arg0, UArg arg1)
{

    uart_multiple_init();
    while(1)
    {
        //UART_read(uart1, a, sizeof(a));
       // UART_read(uart2, c, sizeof(c));
        UART_read(uart3, b, sizeof(b));
        UART_write(uart3, b, sizeof(b));
    }

}

static void uart_multiple_init()
{
     //Create a UART with data processing off.
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 115200;

    uart = UART_open(Board_UART0, &uartParams);

    if (uart == NULL) {
        System_printf("NOT opened");
        System_flush();
         //Turn on user LED
        GPIO_write(Board_LED0, Board_LED_ON);
        System_abort("Error opening the UART");
    }

    UART_Params_init(&uartParams1);
    uartParams1.writeDataMode = UART_DATA_BINARY;
    uartParams1.readDataMode = UART_DATA_BINARY;
    uartParams1.readReturnMode = UART_RETURN_FULL;
    uartParams1.readEcho = UART_ECHO_OFF;
    uartParams1.baudRate = 115200;
    uart1 = UART_open(Board_UART1, &uartParams1);

    if (uart1 == NULL) {
        System_printf("UART1 NOT OPEN");
        System_flush();
        // Turn on user LED
        GPIO_write(Board_LED0, Board_LED_ON);
        System_abort("Error opening the UART");
    }

    UART_Params_init(&uartParams2);
    uartParams2.writeDataMode = UART_DATA_BINARY;
    uartParams2.readDataMode = UART_DATA_BINARY;
    uartParams2.readReturnMode = UART_RETURN_FULL;
    uartParams2.readEcho = UART_ECHO_OFF;
    uartParams2.baudRate = 115200;
    uart2 = UART_open(Board_UART2, &uartParams2);

    if (uart2 == NULL) {
        System_printf("UART2 NOT OPEN");
        System_flush();
         //Turn on user LED
        GPIO_write(Board_LED0, Board_LED_ON);
        System_abort("Error opening the UART");
    }

    UART_Params_init(&uartParams3);
    uartParams3.writeDataMode = UART_DATA_BINARY;
    uartParams3.readDataMode = UART_DATA_BINARY;
    uartParams3.readReturnMode = UART_RETURN_FULL;
    //uartParams3.readEcho = UART_ECHO_OFF;
    uartParams3.baudRate = 115200;
   // uartParams.readMode = UART_MODE_CALLBACK;
   // uartParams.readCallback  = readCallback;
    uart3 = UART_open(Board_UART3, &uartParams3);

    if (uart3 == NULL) {
        System_printf("UART3 NOT OPEN");
        System_flush();
         //Turn on user LED
        GPIO_write(Board_LED0, Board_LED_ON);
        System_abort("Error opening the UART");
    }

}

I request someone to help me on this, I need atleast one UART to receive the data, so that I can solve other UART receive.