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.

New CCS project which has UART functions included from UARTStdio.h

Other Parts Discussed in Thread: TM4C123GH6PM, EK-TM4C123GXL

For the sake of thanking this community for solving my issue ,I would like to write a post on how I overcame this issue thanks to community member Stepman .

I use the TIva C Series Launchpad .

For a program employing UART if you are getting errors like  

  • Description Resource Path Location Type unresolved symbol UARTprintf, first referenced in ./main.obj 

  • Description Resource Path Location Type

          unresolved symbol UARTStdioConfig, first referenced in ./main.obj 

Then you have not copied or linked your uartstdio.c file from utils/uartstdio.c

If you are getting errors like

  • Description Resource Path Location Type
  • #20 identifier "GPIO_PA0_U0RX" is undefined main.c /SPI line 113 C/C++ Problem

  • Description Resource Path Location Type
  • #20 identifier "GPIO_PA1_U0TX" is undefined main.c /SPI line 114 C/C++ Problem


Then you have to do the following steps :-

1.Right Click on your project and go to properties->arm compiler->advanced options->predefined symbols
2.Their , in the Pre-Define name area add

    a)PART_TM4C123GH6PM or whichever MCU part name you are using 
    b)PART_IS_BLIZZARD_RB1 for the Tiva C series and PART_IS_BLIZZARD_RA1 for previous versions .


The above should also be of help when you get errors related to other Pin definitions such as for SPI and PWM pin defs.


Make sure that if you have included  DEBUG in pre-define names then you include  debug statements as follows
in main.c

//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
    UARTprintf("Error at line %d of %s\n", ui32Line, pcFilename);
    while(1)
    {
    }
}
#endif



Prior to the above make sure that you have added driverlib.lib in properties->arm linker->include library
Navigate to driverlib->CCS->Debug->driverlib.lib

Make sure that you also add this file to your project .


And if you are on a noob level don't forget to include TivaWare directory in your include options . 



 

 


 

 

 

  • I done same things...

    But I cat see the UARTPrintf() values on hyperterminal....I reset and tried, Is that anything we need to change or add...

  • Ensure that the baud rate of the Uart and that which Hyper terminal runs at is the same .
    If it still doesn't work press the reset button after setting up hyper terminal .
    Else you could also download Putty  and see if it would work .

    There is nothing "more" to do apart from the above to get UART working .
    Maybe your code is faulty .

  • I believe that there is no problem in Hyper terminal side.

    SOmething i missed to the code....or settings

  • @Dnandha

    Can you post the code section which Initializes the UART. That would be helpful on the SW aspect of the setup Also What Clock Settings are you using for System Clock.

    On the HW side, did you trying scoping the UART-TX lines to see if actually something is getting transmitted. Sometimes the HyperTerminal also hangs, so closing and restarting the same would be a good option.

    Make sure the Device Manager has the correct settings for the COM Port which is being used. Even that could be a potential place where things may not wok.

    Amit


  • #include <stdint.h>
    #include <stdbool.h>
    //#include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    //#include "inc/hw_nvic.h"
    #include "inc/hw_types.h"
    //#include "driverlib/debug.h"
    //#include "driverlib/fpu.h"
    #include "driverlib/gpio.h"
    //#include "driverlib/interrupt.h"
    #include "driverlib/pin_map.h"
    //#include "driverlib/rom.h"
    #include "driverlib/sysctl.h"
    //#include "driverlib/systick.h"
    //#include "driverlib/uart.h"
    #include "utils/uartstdio.h"
    #include "inc/tm4c123gh6pm.h"

    //*****************************************************************************
    //
    //! \addtogroup example_list
    //! <h1>Hello World (hello)</h1>
    //!
    //! A very simple ``hello world'' example. It simply displays ``Hello World!''
    //! on the UART and is a starting point for more complicated applications.
    //!
    //! UART0, connected to the Virtual Serial Port and running at
    //! 115,200, 8-N-1, is used to display messages from this application.
    //
    //*****************************************************************************


    //*****************************************************************************
    // Configure the UART and its pins. This must be called before UARTprintf().
    //*****************************************************************************
    void InitConsole(void)
    {
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    // ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200,
    // (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
    // UART_CONFIG_PAR_NONE));

    // Initialize the UART for console I/O.
    //UARTStdioInit(0);
    }

    int main(void)
    {
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

    // Initialize the UART.
    InitConsole();
    //ROM_UARTStdioInit(0);

    UARTprintf("It is working\n");
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);

    while(1)
    {
    // Toggle between on and off with a delay.
    // Turn on led.
    UARTprintf("ON \n");
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, ~GPIO_PIN_2);
    SysCtlDelay(10000000);

    // Turn off led.
    UARTprintf("OFF \n");
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
    SysCtlDelay(10000000);
    }//while
    }//main

    try it............

  • Assuming your led's are blinking .

    You haven't set a clock source to UART .You have commented out a statement which sets a clock to the UART .

    Let the Uart clock source statements be commented ,
    You need to set up a clock source like so ...

     UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

    and configure the UARTStdio settings like so 

     UARTStdioConfig(0, 115200, 16000000);


    If this answered your question please hit the "Yes button "

  • Its working :-)

    Thank u so much.....

  • Another small suggestion - 

    If you are using the TIVA C Series launchpad ,then there are plenty of beginners example programs in the TivaWare folder . It is excellently documented ,reliable and exhaustive .


    I would appreciate it if you were to press the Yes button next to the "Did this answer your question " area .It means a lot in this community :D

  • Actually I finding to press YES button....

  • hi there,

    meanwhile running out off ideas...
    I try to implement:
    "c:\ti\TivaWare_C_Series-2.0.1.11577\examples\peripherals\adc\single_ended.c"

    My setup:

    CCS Version: 5.5.0.00077
    c:\ti\TivaWare_C_Series-2.0.1.11577\
    Launchpad EK-TM4C123GXL

    compiling seems OK:

    'Finished building: ../main.c'
    'Finished building: ../tm4c123gh6pm_startup_ccs.c'

    the Linker says:

    >> Compilation failure

     undefined       first referenced

      symbol             in file    

     ---------       ----------------

     UARTStdioConfig ./main.obj     
     UARTprintf      ./main.obj     

    error #10234-D: unresolved symbols remain error #10010: errors encountered during linking;
    "myADC.out" not built

    thes functions are in #include "utils/uartstdio.h"

    I guess, a Compiler/Linker-Option to "utils/uartstdio.h" is needed...

    can help anybody ?

    greetings
    Thomas

  • Hi Thomas,

    I don't have CCS. You, need to add uartsdio.c at your project. Similar to this below at the interrupt example program using Keil Uvision.

    -kel

  • I think my instructions at the beginning of the post are sufficient .
    Please read through carefully 

  • I love this community...





    In CCS I added the "uartstdio.c" as Link (should be the clean path)
    and it works ;-)

    Thanks a lot...

  • Hi Rakshit,

    you're right... - READ CAREFULLY

    "Then you have not copied or linked your uartstdio.c file from utils/uartstdio.c"


    sorry

  • Hello,

    I have just initialized UART1 with TivaC launchpad but it is not working there might be something missing out so  I am posting my code so if any one can help me  where is my initialization wrong? I am not able to print even 'welcome' nor I am able to send or receive any data. I have checked my terminal window and my com number and baudrate are also fine.

    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_can.h"
    #include "inc/hw_adc.h"
    #include "inc/hw_types.h"
    #include "driverlib/debug.h"
    #include "driverlib/fpu.h"
    #include "driverlib/gpio.h"
    #include "driverlib/adc.h"
    #include "driverlib/can.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/timer.h"
    #include "driverlib/uart.h"
    #include "utils/uartstdio.h"

    volatile int g_ui32Flags;


    #ifdef DEBUG void __error__(char *pcFilename, uint32_t ui32Line)
    {
    }
    #endif

    void Timer0IntHandler(void)
    {
    char cOne, cTwo;
    ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
    HWREGBITW(&g_ui32Flags, 0) ^= 1;
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, g_ui32Flags << 1);
    ROM_IntMasterDisable();
    cOne = HWREGBITW(&g_ui32Flags, 0) ? '1' : '0';
    cTwo = HWREGBITW(&g_ui32Flags, 1) ? '1' : '0';
    UARTprintf("\rT1: %c T2: %c", cOne, cTwo);
    ROM_IntMasterEnable();
    }
    void Timer1IntHandler(void)
    {
    char cOne, cTwo;
    ROM_TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
    HWREGBITW(&g_ui32Flags, 1) ^= 1;
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, g_ui32Flags << 1);
    ROM_IntMasterDisable();
    cOne = HWREGBITW(&g_ui32Flags, 0) ? '1' : '0';
    cTwo = HWREGBITW(&g_ui32Flags, 1) ? '1' : '0';
    UARTprintf("\rT1: %c T2: %c", cOne, cTwo);
    ROM_IntMasterEnable();
    }


    unsigned char a,b;
    int main(void)
    {
    //Setting Clock
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

    //Enabling UART1

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);

    GPIOPinConfigure(GPIO_PB0_U1RX);
    GPIOPinConfigure(GPIO_PB1_U1TX);

    GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //Configuring UART

    UARTConfigSetExpClk(UART1_BASE,16000000, 9600, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

    UARTClockSourceSet(UART1_BASE, UART_CLOCK_PIOSC);
    UARTStdioConfig(1, 9600, 16000000);


    while(1)
    {
    UARTprintf("welcome\n");
    UARTCharPut(UART1_BASE,'d');

    while(!UARTCharsAvail(UART1_BASE));
    a=UARTCharGet(UART1_BASE);

    UARTCharPut(UART1_BASE,a);


    }

    }

  • You see, i also have the TM4C123G6PM, and im using:

    #include "driverlib/uart.h"
    #include "utils/uartstdio.h"

    void ConfigureUART(void){

    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    ROM_UARTStdioConfig(0, 115200, 80000000);
    }

    and im having problems in the Uart anyway

    Description Resource Path Location Type
    #20 identifier "GPIO_PA0_U0RX" is undefined main.c /Sd_Card line 90 C/C++ Problem

    Description Resource Path Location Type
    #20 identifier "GPIO_PA1_U0TX" is undefined main.c /Sd_Card line 91 C/C++ Problem

    The only thing i still haven't confirmed is the

    b)PART_IS_BLIZZARD_RB1 for the Tiva C series and PART_IS_BLIZZARD_RA1 for previous versions .

    because i dont know how.

    im also having troubles with warnings in the functions with ROM, i dont know if it's related.

    I have rom.h and rom_map.h included in libraries

  • Hi Victor,

    Victor Azevedo said:

    Description Resource Path Location Type
    #20 identifier "GPIO_PA0_U0RX" is undefined main.c /Sd_Card line 90 C/C++ Problem

    Description Resource Path Location Type
    #20 identifier "GPIO_PA1_U0TX" is undefined main.c /Sd_Card line 91 C/C++ Problem

    Setting PART_TM4C123GH6PM at preprocessor symbols at your IDE, would solve this compile error.

    Victor Azevedo said:

    The only thing i still haven't confirmed is the

    b)PART_IS_BLIZZARD_RB1 for the Tiva C series and PART_IS_BLIZZARD_RA1 for previous versions .

    At my Tivaware copy it is TARGET_IS_BLIZZARD_RB1.

    What you can do ease your burden with these kind of compile errors is just use an existing working example program like "hello" or "uart_echo" then append your code. 

    - kel

  • Then you have not copied or linked your uartstdio.c file from utils/uartstdio.c
    ::::::::::::::::
    I included #include "utils/uartstdio.c"
    and still give errors ??
  • Hello Ibrahem,

    You can Add the files as link.

    Regards
    Amit