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.

UART Channels Other Then Default: TI-RTOS / LM4F120

Hello, I am wondering if there is anything special I need to do to setup UART1 through UART7?  Essentially, I am trying to make the uartecho example work with UART1.  Ultimately I need 3 channels to be active.

This is my initializationin LM4F120H5QR.c:

Void LM4F120H5QR_initUART1()
{
     /* Enable and configure the peripherals used by the uart. */
     SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
     GPIOPinConfigure(GPIO_PB0_U1RX);
     GPIOPinConfigure(GPIO_PB1_U1TX);
     GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);

     /* Initialize the UART driver */
     UART_init();
}

I added this value in LM4F120HQ5R.h:

typedef enum LM4F120H5QR_UARTName {
     LM4F120H5QR_UART0 = 0,
     LM4F120H5QR_UART1,

     LM4F120H5QR_UARTCOUNT
} LM4F120H5QR_UARTName;

This is my configuration of the channel:

/* 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;
uart = UART_open(Board_UART1, &uartParams);

if (uart == NULL) {
    System_abort("Error opening the UART");
}

Any help would be greatly appreciated!

  • I figure out my error.  I missed adding this:

    /* UART configuration structure */
    const UART_HWAttrs uartHWAttrs[LM4F120H5QR_UARTCOUNT] = {
          {UART0_BASE, INT_UART0}, /* LM4F120H5QR_UART0 */
    *****{UART1_BASE, INT_UART1}, /* LM4F120H5QR_UART0 */
    };

  • Hi Ben,

    Sounds like you are up and running, but I thought I'd talk about "board.c" some for the benefit of others that may read this. The "board.c" (or in your case LM4F120H5QR.c) is meant to be changed by the user (like you are doing). We tried to avoid having the drivers do board specific things (like pinmuxing). This needs to be done by the user in the "board.c" file. For your case, you have to add more entries into the UART_HWAttrs array and also the UART muxing in the LM4F120H5QR_initUART() function.

    Let us know if you have anymore questions or feedback.

    Thanks,
    Todd