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 initialisation in TM4c123

Hi,

I am trying to initialise UART PORT 1 in TM4C123 TIVA launchpad board. but the program is aborting.

I have referred the example codes given in the repository to write this code with the only difference of using UART1 instead of UART0.
 All the examples of UART uses UART0 but that is not accessible in my board as it is used by debugger.

The examples use BOARD_UART0 #define in the APIs but there are no #defines for other PORTS.

Please help.

Code is as shown below.

void initUART(void)
{
    /* 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. Set the baud rate, number of data bits, turn off
    // parity, number of stop bits, and stick mode.


//
    /* 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 = 9600;

   /* Initialize the UART driver */
#if TI_DRIVERS_UART_DMA
    EK_TM4C123GXL_initDMA();
#endif


    UART_init();


    uart = UART_open(1, &uartParams);

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

Thanks and Regards,


Nayan