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-TM4C123GXL: How to run can example on can bus of EK-TM4C123GXL ?

Part Number: EK-TM4C123GXL

I want to learn can protocol by running code on EK-TM4C123GXL.

what is way to achieve this goal easily ?

i have to connect this micro controller with ixxact usb-to-can FD to debug the message sent from tiva board.

Which line i need to use from this board to connect with above mentioned can debugger ?

  • Hi,

      The best way to learn CAN is to reference the CAN examples. You can find CAN examples in TivaWare SDK. First install TivaWare SDK from https://www.ti.com/tool/SW-TM4C if you have not done so. Once installed, you can find examples in C:\ti\TivaWare_C_Series-2.2.0.295\examples\peripherals\can directory. There are examples for transmitter and receiver. You need to have two boards with one transmitting and the other receiving the messages. You must have a CAN transceiver for each node on the network. In addition, you must have proper termination resistors on the network in order to run the examples. One more thing is that the CAN module on the MCU is compliant to CAN protocol version 2.0 part A/B with bit rate up to 1Mbps. It does not support FD if Fast Data higher than 1Mbps is what you are referring to.

    Depending on which CAN module as there are two CAN modules on the MCU, you can refer to the the datasheet for which pin you want to use. Use the TivaWare example as they are designed to work out of box from the software point of view. 

      This website has good introduction to CAN protocol. https://www.kvaser.com/can-protocol-tutorial/

  • I want to know tm4c123gxl does not contain the can transceiver ?

    if it does not have then from where i will get it ?

    To connect this two tm4c123gxl board which pin i need to to use ? if possible tell me that pin names and provide schematic for same.

    i want confirm that tm4c123gxl support standard can frame and extended can frame but it not support can FD ?

    To configure this project what i need to do ?

    As well as can you tell me what extra thing needed to set up and build project of can from below attached image:

       

    Because i can not able to build it.

  • To configure this project what i need to do ?

    Looks like you are very new to this MCU. If that is the case, why don't you start with a simple blinky or hello example to get a feel on how the MCU works. Have you downloaded TivaWare SDK yet? These are examples you can find in TivaWare SDK. Once you get the example working, you can just copy the CAN example source code and replace the hello example. 

    EK-TM4C123GXL does NOT contain the CAN transceiver. You can visit this product page for TI CAN transceiver. https://www.ti.com/interface/can-lin-transceivers-sbcs/products.html

    I thought I  showed you the pins for CAN . It depends on which CAN module you want to use. Look at the table again, please. The CAN example uses PB4 for CAN0RX and PB5 for CAN0TX. If you use the example then it is already setup for you. If you want to change to other pins, you are free to do so. For example, you can also use PE4 for CAN0RX and PE5 for CAN0TX. If you want to use the stock example, then you just connect PB4 and PB5 to the CAN transceiver. 

    Below is the snippet of code in the example that configures PB4 and PB5 for CAN0RX and CAN0TX functions. 

    //
    // For this example CAN0 is used with RX and TX pins on port B4 and B5.
    // The actual port and pins used may be different on your part, consult
    // the data sheet for more information.
    // GPIO port B needs to be enabled so these pins can be used.
    // TODO: change this to whichever GPIO port you are using
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

    //
    // Configure the GPIO pin muxing to select CAN0 functions for these pins.
    // This step selects which alternate function is available for these pins.
    // This is necessary if your part supports GPIO pin function muxing.
    // Consult the data sheet to see which functions are allocated per pin.
    // TODO: change this to select the port/pin you are using
    //
    GPIOPinConfigure(GPIO_PB4_CAN0RX);
    GPIOPinConfigure(GPIO_PB5_CAN0TX);

  • Dear i have run many other ready made code but not have practice of create new project. so to set up the project i does not know.

    but by reading the sdk document i am thinking that form below image if put single code then it may be able to build ?

    To configure this project what i need to do ?

    i want confirm that tm4c123gxl support standard can frame and extended can frame but it not support can FD ?

    I am using linux so i can not install sdk.

    i have tried to use single file from peripheral library and created one project for can but it show many errors. what i have done wrong for it  ?

    i also want to know in suggested pin of can which work as can high and which work as can low ?

    i have tried to set up project by using one of the ca peripheral file but i am getting errors:

    And also one query is that if tm4c123gxl does not contain the can transceiver then how can peripheral code will work for it ?

  • I think you haven't got the basics to run the example. You can't just compile a one file multi_rx.c file without initializing the device like setting the vector table. As I suggested, please run a very very basic example like hello. You can import the hello project from C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c123gxl\hello. In CCS, do an import as shown below. 

    One you import the hello project, load the program to the flash and run it. Report back if you can even run this example. Open a terminal window of your choice and you should see 'hello world' displayed on the terminal. If you can successfully run this example, you just remove the hello.c file and replace with the simple_tx.c file. After you rebuild it again, the project will configure the CAN module and send simple CAN message. Go through the hell project. The project does not contain the hello.c file but also quite a few other files like the linker command file and startup file and utility files. The hello example is a complete CCS  project. 

  • when i am importing hello project on linux ccs i am getting below error

  • How did you import the project? Import does not mean a simple copy folder. The import will also set up the CCS settings for the project. I just wanted you know that. 

    Show your project folder. You should see something like below after you import the project. 

  • Dear first time i made mistake but now i can able to build hello project as well as can related file you suggested.

    Still i have below queries :

    1] i want confirm that tm4c123gxl support standard can frame and extended can frame but it not support can FD ?

    2] i also want to know in suggested pin of can which work as can high and which work as can low ?

    3] And also one query is that if tm4c123gxl does not contain the can transceiver then how can peripheral code will work for it ? if i want to connect 2 tiva board using can for run suggested code will it work without transceiver ? does tiva board consist transceiver ?

  • Glad that you can import the hello project. Read the code to get a feel for it. You can import other examples like blinky. Once you are familiar with the code such as how APIs are used to initialize different modules then you can move on to your CAN example. Just replace the hello.c code with simple_tx.c code and recompile it. Without the transceiver, it will not work but you should be able to see some activities on the CANTX pin if you have a scope. Ultimately, you need the transceiver to build a functional CAN network.

  • 1] i want confirm that tm4c123gxl support standard can frame and extended can frame but it not support can FD ?

    2] i also want to know in suggested pin of can which work as can high and which work as can low ?

    3] And also one query is that if tm4c123gxl does not contain the can transceiver then how can peripheral code will work for it ? if i want to connect 2 tiva board using can for run suggested code will it work without transceiver ? does tiva board consist transceiver ?

    yes, it supports both standard and extended frame. Please read the datasheet. 

    CANH and CANL pins are what go to the CAN bus from the transceiver. MCU does not have these pins. MCU sends the CANTX and CANRX to the transceiver and the transceiver converts them to CANH and CANL. You need to study how CAN works. I already sent you the website with information. You can Google search your own.

    I have mentioned several times you need a transceiver. You need to build your circuit with MCU and transceiver. Why don't you read this app note to understand the role of CAN controller and CAN transceiver. https://www.ti.com/lit/pdf/sloa101

  • Can you suggest similar type of board that come with transceiver 

  • This app note demonstrates the a CAN boosterpack that can be plugged in to the EK-TM4C123GXL LaunchPad. The CAN bootsterpack has the transceiver on it. 

    https://www.ti.com/lit/pdf/spna244

  • Actually it's not easily available for India. so if you can suggest other

  • Hi,

      You will need to build your own prototype board if you have no access to that daughter card that can plug onto the LaunchPad. Sorry, I don't know what else to suggest.