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.

UARTprintf

Hi;

I want to use UARTprintf for my project with TM4C129 but also i have to use uart2. I have seen one of examples in enet.io examples code but at there uart0 is used and i could not change it to uart2. Do you have any idea?

  • I would suggest using the search capability at the top of the page to search this forum for more information on UARTprintf. There are large number of threads on this topic.

    For your case, the most likely to provide some help would be this post:
    e2e.ti.com/.../312134

    Some additional threads that might be helpful are:
    e2e.ti.com/.../245433
    e2e.ti.com/.../1504931
    e2e.ti.com/.../337933
    e2e.ti.com/.../337351
    e2e.ti.com/.../1238303

    You may want to have a look at threads about UART2 as well:
    e2e.ti.com/.../427937
    e2e.ti.com/.../324320

    Please have a look at these threads and let me know if you need any additional help.
  • Hi chuck;

    I took a look these questions before. I can use UARTprintf and UART2 separately but not together. I 'm pasting code here . The code does not get in to the while loop and only send 'T' one time.

    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "driverlib/gpio.h"
    #include "drivers/pinout.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/uart.h"
    #include "utils/uartstdio.h"

    uint32_t g_ui32SysClock;

    void
    ConfigureUART(void)
    {
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    UARTIntClear(UART2_BASE,UART_INT_RX | UART_INT_RT );
    GPIOPinConfigure(GPIO_PA6_U2RX);
    GPIOPinConfigure(GPIO_PA7_U2TX);

    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);

    UARTConfigSetExpClk(UART2_BASE, g_ui32SysClock, 115200,(UART_CONFIG_WLEN_8 |UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
    }
    int
    main(void)
    {
    g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
    SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
    SYSCTL_CFG_VCO_480), 120000000);
    PinoutSet(false, false);

    ConfigureUART();

    UARTCharPut(UART2_BASE, 'T');
    UARTprintf("Hello, world!\n");

    while(1)
    {
    SysCtlDelay(g_ui32SysClock / 10 / 3);
    UARTCharPut(UART2_BASE, 'T');
    UARTprintf("Hello, world!\n");
    SysCtlDelay(g_ui32SysClock / 10 / 3);
    }
    }
  • Hello user3667254,

    Have you made any changes to the uartstdio.c file in your project. If yes then can you please share the same?

    Regards
    Amit
  • No Amit,I did not change anything in uartstudio.c

  • Hello user3667254,

    Please call the function UARTStdioConfig with first parameter as 2 instead of calling UARTConfigSetExpClk

    Do make sure that the UART2 IO's for TX and RX are configured.

    Regards
    Amit