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.

TM4C123GH6PM LAUNCHPAD PROGRAMMING

I am trying to do the CAN simple_TX program on the TM4C123GH6PM tivac launchpad

I make all the necessary pin configurations needed for the launchpad, 

Added the CANIntHandler() to the vector table.

But now I am getting the errors

#10010 errors encountered during linking; "TI.out" not built   (TI being the project name)

#10234-D  unresolved symbols remain 

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


Please advice

This is the code

#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_can.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/can.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"


volatile uint32_t g_ui32MsgCount = 0;


volatile bool g_bErrFlag = 0;

void
InitConsole(void)
{
    
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    GPIOPinConfigure(0x00000001);
    GPIOPinConfigure(0x00000401);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

    UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    UARTStdioConfig(0, 115200, 16000000);
}

void
SimpleDelay(void)
{
    SysCtlDelay(16000000 / 3);
}

void
CANIntHandler(void)
{
    uint32_t ui32Status;

    ui32Status = CANIntStatus(CAN0_BASE, CAN_INT_STS_CAUSE);

    if(ui32Status == CAN_INT_INTID_STATUS)
    {
        ui32Status = CANStatusGet(CAN0_BASE, CAN_STS_CONTROL);

        g_bErrFlag = 1;
    }

    else if(ui32Status == 1)
    {
        CANIntClear(CAN0_BASE, 1);

        g_ui32MsgCount++;

        g_bErrFlag = 0;
    }

    else
    {
        
    }
}

int
main(void)
{
    tCANMsgObject sCANMessage;
    uint32_t ui32MsgData;
    uint8_t *pui8MsgData;

    pui8MsgData = (uint8_t *)&ui32MsgData;

    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_16MHZ);

    InitConsole();

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

    GPIOPinConfigure(0x00011008);
    GPIOPinConfigure(0x00011408);

    GPIOPinTypeCAN(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_5);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);

    CANInit(CAN0_BASE);

    CANBitRateSet(CAN0_BASE, SysCtlClockGet(), 500000);

    CANIntRegister(CAN0_BASE, CANIntHandler); // if using dynamic vectors
    
    CANIntEnable(CAN0_BASE, CAN_INT_MASTER | CAN_INT_ERROR | CAN_INT_STATUS);

    IntEnable(INT_CAN0);

    CANEnable(CAN0_BASE);

    ui32MsgData = 0;
    sCANMessage.ui32MsgID = 1;
    sCANMessage.ui32MsgIDMask = 0;
    sCANMessage.ui32Flags = MSG_OBJ_TX_INT_ENABLE;
    sCANMessage.ui32MsgLen = sizeof(pui8MsgData);
    sCANMessage.pui8MsgData = pui8MsgData;

    while(1)
    {
        UARTprintf("Sending msg: 0x%02X %02X %02X %02X",
                   pui8MsgData[0], pui8MsgData[1], pui8MsgData[2],
                   pui8MsgData[3]);

        CANMessageSet(CAN0_BASE, 1, &sCANMessage, MSG_OBJ_TYPE_TX);

        simpleDelay();

        if(g_bErrFlag)
        {
            UARTprintf(" error - cable connected?\n");
        }
        else
        {
            UARTprintf(" total count = %u\n", g_ui32MsgCount);
        }

        ui32MsgData++;
    }

    return();
}

  • ss_tej said:

    #10234-D  unresolved symbols remain 

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

    Possibly that you have not set the correct paths for your project. This error is like in violation of the one definition rule.

    One way to get pass this problem is to use an existing working example program like hello and just append your code. The project settings are already setup, so you don't have to worry much about it.

    - kel

  • Append how Marcel Robregado ?

    Just adding it, is creating errors

  • ss_tej said:
    unresolved symbol UARTStdioConfig, first referenced in ./main.obj

    As you can see the hello example program compiles without errors and also has the UARTStdioConfig already included in the libraries. So, add the CAN code to it. This way also you would know if that after adding some code to hello example program, you would know if your added code cause it to have build errors. If there are build errors, fix it accordingly.

    - kel

  • Hello ss_tej,

    I agree with Kel. You can add the uartstdio.c to the project. It should not give any compilation errors. If it is giving errors, please do paste the errors.

    Regards

    Amit

  • Hi, I face the same errors when I try CAN bus simpletx.c example in TIVA Launchpad. The example is given in the 

    C:\ti\TivaWare_C_Series-2.1.0.12573\examples\peripherals\can folder. 

    I included the simpletx.c file in another project but I am still facing the same errors. What shall I do?

    Any suggestions would be appreciated. 

  • Hi Zairah,

         Use working example programs such as "hello" then append simpletx.c code to it. This way, you don' t need to worry about the project settings.

    - kel