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.

EK-TM4C1294XL: Help with UART module

Part Number: EK-TM4C1294XL

Hi, I'm trying to set up the UART module of my TM4C1294XL board but I can't answer a question: "If I want  to setup the UART module did I must call  the UARTClockSourceSet() function?"

In order to illustrate my problem, that's how I'm trying to configure the UART module

  /*Initialize GPIOC for UART*/
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
  /*Enabling UART7*/
  SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);

  /*Configuring GPIO pins for port C*/
  GPIOPinConfigure(GPIO_PC4_U7RX);
  GPIOPinConfigure(GPIO_PC5_U7TX);

  /*Setting up GPIOC pins for UART function */
  GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);

  /*Setting UART7 clock source*/

  /*Setting UART7 configurations*/
  UARTConfigSetExpClk(UART7_BASE,UART_CLOCK_PIOSC,9600, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_EVEN))

I'm using UART_CLOCK_PIOSC in the second parameter of the configuration function because I want to have 16MHz for UART7 clock and I don't know if I have to call  UARTClockSourceSet(UART7_BASE, UART_CLOCK_PIOSC) before doing it.

  • The second parameter of the function UARTConfigSetExpClk() is the source clock rate, not which source to use. If you use PIOSC as the UART clock source, then the second parameter should be 16000000 (for 16 MHz). The default UART clock source is the system clock, so unless you are using PIOSC as the system clock, you must call  UARTClockSourceSet(UART7_BASE, UART_CLOCK_PIOSC).

  • dear jemelly,
    You need not call UARTClockSourceSet() function. Directly put data in output buffer using UARTCharPut(). And after enabling UART module wait till it gets ready using following loop.
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART6);

    // Wait for the UART6 module to be ready.
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_UART6))
    {
    }

    regards,
    degvijay
  • Greetings Bob,

    Staff notes your response as "very well" explained.

    Yet - as revealed by your "highlighting skills" ...  it must be asked:   a) were you "at sea" and/or  b) had a recent  "neurological exam" - and "passed?"

  • Thanks, Bob. That resolved my Issue :)