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.

TM4C1294NCPDT CANBus Hanging?

Other Parts Discussed in Thread: ISO1050

Hi,

I am trying to get CANBUS to work. I don't have much experience with it.
I have two TM4C194NCPDT Tiva Boards to act as two different CANBUS nodes.

I am using the code from Amit in this thread as reference: http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/363647 

The UART and CANBUS initialization looks to be correct, so no modification was necessary in the code I believe. (usage of UART0 on A0, A1; CANBUS1 B0,B1)

I have the 3.3V and GND from the board connected to CANBUS transceivers SN65HVD231QD. Same pinout as the one Amit used in the above thread.

The D pin is connected to CAN1TX, R pin is connected to CAN1RX. CANH and CANL are terminated by 100 Ohm resistors (I didnt have 120ohm with me).

I dont have Vref connected to anything. Rs pin is grounded. These connections are done on a breadboard if that matters.

I have one board loaded with the TX code and other board loaded with RX code. I observe the UART print statements via putty console since each board's UART goes to a different COM port. It appears that the TX CANBUS hangs because it does not get past the first print statement (first message).

Does my hookup at least sound right? Any ideas what could be stopping this from plainly working?

  • Silly question I don't see, 100Ohm are ok but CANH is connected to CANH and CANL to CANL and both have resistor between CANH CANL at end of transmission line?
    Amit used different drivers but the one you mentioned here is ok and connected right way in your word.
    Is software sending some error message to usart like timeout, cable unconnected?
  • Tiva1 CANTX -> D of transceiver | transceiver CANH <-> CANH <-D of transceiver <- Tiva2 CANTX
                                                                             100ohm |                   | 100 ohm
    Tiva1 CANRX -> R of transceiver | transceiver CANL <-> CANL <- R of transceiver <- Tiva2 CANRX

    @Roberto Yes. I have CANH to CANH and CANL to CANL. 100ohm between CANH and CANL on one end and another 100ohm between CANH and CANL on the other end.

    What do you mean by different drivers?
    There is no error message. It just hangs. Here is the output from the TX side:
    Sending msg: obj=1 ID=0x1001 msg=0x00 00 00 00
    Se
    ^ it hangs partial way to printing over the UART the 2nd message.

    If i do not power the Rx TIVA, then the Tx Tiva prints out its full 3 messages over UART:
    Sending msg: obj=1 ID=0x1001 msg=0x00 00 00 00
    Sending msg: obj=2 ID=0x2001 msg=0x02 02 02 02 02
    Sending msg: obj=3 ID=0x3001 msg=0x03 03 03 03 03 03

  • Ok Andrew, I understood it really hang, please connect a scope/LA to CANH and see if there is activity on bus and TX pin too.
    Attach debugger to TX side then see what happen when cpu hang, ISR Fault, infinite loop, report where is hanged and then if ISR fault report register as from common issue sticky post on this forum.
    Different drivers mean Amit used 1050 series but don't care, the two you used are ok.
    Also report if controllers are XM or TM and silicon revision too to track if this is a spare issue or known.
    CAN1RX - PB0
    CAN1TX - PB1
    No idea other than load code and try what happen, I don't have your drivers but I am using ISO1050 and another dual can bus drivers I can try tomorrow. Controller is 1294, please correct title to help who search for.
  • What is shown is CANL (1V to 2.2V). CANH is also working (2.2V to around 3V). I only have 1 probe, so they are not on the same screen.

    I probed CAN1Rx of the RX Tiva and it seems like all its receiving is noise through its transceiver.

    The debugger says I get into an unexpected interrupt. Intdefaulthandler() gets called.

  • Hi Roberto,
    I got it to work! So the problem was that I had copy and pasted Amit's "main.c" files for the Tx and Rx programs, but I hadnt copied the startup files which would statically dictate what is the handler function for CAN1. I found the CANINTREGISTER function was not in the code so I used that to dynamically say what the handler function is.
  • Happy to see everything is good and work, if none other issue is present please check verify button to close thread.