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: Need help in TivaWare

Part Number: TM4C123GH6PM

Hello all, 

I am trying to run the CAN example in TivaWare which is simple TX example using CCS. 

I just have a trouble that the ISR doesn't executed. i have tried to register the CANIntHandler in the startup code (statically) and also dynamically using CANIntRegister(CAN0_BASE, CANIntHandler) but the execution still in the while(1) loop in both cases. 

I also observed that the CAN_INT register has the value 0x00000000  all the time even after executing CANMessageSet() function. 

How can i fix this ? 

Regards, 

Sarea

  • Your description leaves much unstated.

    Should you not be employing (both) "Can simple_tx.c AND Can simple_rx.c" and be connected via a proper CAN xcvr - to include termination resistors? Are you connecting "two different CAN-based boards - each equipped w/CAN xcvr & terminated?"

    Your search of this forum (via the search box - atop this page) will reveal "many" such posts - and the requirement for the inclusion of "necessary & sufficient data."
  • How did you setup your CAN network? Do you have transceiver for each node on the network? Do you have at least two nodes on the network?
  • thanks Charles and Cb1, 

    i have 2 tm4c123 Launchpads and 2 MCP2551 CAN transceivers. 

    i use the simple TX and simple RX  existing in TivaWare examples for the first and 2nd Launchpad. 

    120 ohm resistor with simple wires and breadboard. 

    when i burn the RX code on one Launchpad and connect the TX node to CCS debugger . i have this on the Terminal: 

    so, what are the steps i can do to have a successful transmission ? 

    Regards, 

    Sarea 

  • sarea hariri said:
    with simple wires and breadboard

    Have you not posted similarly here - perhaps one of your posts included a photo(s) of your setup?     

    The use of a "speed resisting" breadboard causes concern!       If you must employ a breadboard I'd suggest that you lower the CAN Data Rate to the minimum!

    Those 2 "Simple CAN" example programs have proven "highly successful" - when employed "unchanged!"      The obvious question then - what changes (even small ones) have you made?

    "KISS" dictates that you, "Give the example programs the best "chance to work!"      (which means, "Make NO/ZERO Changes" until the "simple programs" work - only (then) introduce your (small) change - one at a time - and test/verify operation after each/every change is introduced...      

    In this manner - and in this manner ALONE - can you, "Quickly, Efficiently & Easily" discover, "Which of your (likely multiple) changes" - "Caused, Created and/or Contributed" to your ISSUE!      KISS Rules - early & undescribed "poster changes" ... Not so much!  

  • Cb1

    1.

    I have made no changes to the code except in the startup file i added this 

    extern void CANIntHandler(void) ;   // under the existing declarations of default handlers 
    
    
    

    and change the default handler name that corresponding to CAN0 in the startup file  (IntDefaultHandler) to the name of  the handler

    included in the example (CANIntHandler)..

    this is exactly what i changed. 

    2.

    The rate in the example code is 500 KHz. Could you please suggest a minimum rate i can use ? 

    3.

    sorry for not posting a photo of my circuit but i don't think it will be clear. instead i can tell you the wiring. 

    i just use 5 volt supply from the USB port of the Laptop and connect RX, TX to PB4, PB5. 

  • so what error did you get? Put a breakpoint in your CANIntHandler and see what is returned after the CANIntStatus() is called? It will tell you the error type.

    Please capture the tx and rx pins on the scope and you will get better idea what is wrong.

    Here is one recent post that you may find helpful. e2e.ti.com/.../2340487
  • Thanks Charles 

    it works properly now but i really still don't know what was the problem :)

    i may connect wrongly some wires or something like that. it all works properly now and i observed the terminal  for the 2 nodes.. thank you

    Regards,

    Sarea

  • Thank (only) Charles? Of course Charles is great - but cb1 ain't "chopped liver." (maybe - on some (good) days...)

    Note that your CAN Xcvr is 5V powered - may not prove reliable w/3V3 signal levels from TM4C! (you may apply a Green here now - as well!)

    When using a breadboard ALWAYS reduce speed - you are in NO RACE - your interest is, "Making the circuit work!"     Dial the speed to 250K or even lower - "Breadboards are not designed to support high speed - will cost you HOURS of lost/misspent time!

  • of course i didn't mean it :)
    big thanks Cb1 for your helpful advice.

    Regards,
    Sarea