How to use CAN on JETSON TX2?

New to the Jetson in general, but wanting to use CAN on the TX2. (If it’s possible)
Already installed Ubuntu, ROS, and the latest drivers/firmware(28.1).
Any information to use CAN on the TX2 will help!
Thank you!

Hi,

Yes, Jetson TX2 supports CAN communication among CAN nodes.
TX2 has 2 CAN controllers.
To make use of CAN communications, CAN transceiver has to be interfaced with each of the controllers.
CAN transceiver is the interface between a controller area network (CAN) protocol controller and the physical bus.
To interface transceiver with CAN controller please follow TX2 TRM (CAN topic).
For a quick setup please check the below pin description and the attachment.

J26 PIN === Desc.
1=======CAN wake

3=======CAN0 STAND BY
5=======CAN0 RX
7=======CAN0 TX
9=======CAN0 ERR

13======CAN1 STANDBY
15======CAN1 RX
17======CAN1 TX
19======CAN1 ERR

Once you interface them properly, below steps can be followed to achieve proper communication.

Steps to enable and check CAN on TX2:

  1. Enable kernel support for mttcan (Other required modules are already supported)

  2. Insert CAN BUS subsystem support module.
    modprobe can

  3. Insert Raw CAN protocol module (CAN-ID filtering)
    modprobe can_raw

  4. Real CAN interface support (for our case, it is: mttcan)
    modprobe mttcan (dependent module is can_dev: can driver with netlink support)

  5. CAN interface settings for both the controllers
    ip link set can0 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
    ip link set up can0
    ip link set can1 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
    ip link set up can1

  6. Installation of user app to check CAN communication
    sudo apt-get install can-utils

  7. Commands to run to check CAN packet send/receive
    broadcasting a can data packet:
    cansend <can_interface> <can_frame>
    e.g. cansend can0 123#abcdabcd

    Receiving a can data packet:
    candump can_interface
    e.g. candump can1

    Different tools (i.e. cangen, cangw etc) can be used for various filtering options.

  8. To check the interface statistics
    ip -details -statistics link show can0
    ip -details -statistics link show can1

JetsonTX2_CAN.png

Hi,
I have used your topic above and everything works fine.
I am sending data from CAN0 to CAN1 via 2 tranceivers SN65HVD230 using cansend and candump.
But if during the sending i disconnect the wires and break the link between can0 and can1 and try to send again my Nvidia tx2 freezes and i need to restart it.
I think that Can Message RAM is filled up with data and because is not been sended it crashes.
Did someone tried to send data and then break the loop betweend Can0 and Can1?

Hi Marius_I,

We will clarify and reply in your topic - https://devtalk.nvidia.com/default/topic/1030241/jetson-tx2/nvidia-tx2-freeze-after-disconnecting-from-3-3v-pin-the-can-bus-transceivers-sn65hvd230-during-the-cansend/

Thanks

Hi, I was hoping for some help following this post.

I am currently attempting to communicate between my TX2 and an arduino Teensy using CAN. I am using a MCP2561/2 transceiver with each controller. I have flashed the TX2 with mttcan = y and followed the instructions above, however, when I try to do cansend on my can0 there doesn’t seem to be any action on the TX0 line.

If I send from my Teensy I am able to track the message all the way to the RX0 line of the TX2, but candump shows no message.

Any advice would be appreciated. Thanks!

MCP2561/2 - http://ww1.microchip.com/downloads/en/DeviceDoc/20005167C.pdf

%%%%%

Resolved

Hi Ckann,

We need to have logs to analyze whats going wrong.

Please provide the complete boot log (this is required as your mttcan module is built statically)
Also please provide the kernel log while doing candump on mttcan.

Thanks & Regards,
Sandipan

Sparta,

I have also followed the steps given above for configuring the CAN devices, and I am running into the same problem that Ckann is. I write to my can0 port, and see no action on the CANTX pin. I do not have a transceiver tied to the pins yet, but I expect to see changes happening on the CANTX pin with my oscilloscope.

See next post…

Our implementation of CAN bus uses a TI canbus transceiver and does not use CANERR or CANSTBY signals. I’ve reviewed the reference design and also various other sources… it seems like there is no requirement on those signals for any pullup or pulldown resistors if they are not implemented.

Our implementation is working without them for both CAN0 and CAN1, using only the TX and RX lines. My question are along the lines of good design practice: Should we tie CANERR and CANSTBY high or low? Pull them up or down? Or is it okay to leave them as no-connect inputs?

Feedback will be appreciated.

EDIT: Also, I can’t find the bit-rate specification for the TX2 or TX2i anywhere. I’m in charge or writing the User Manual for our new product. I would like to quote the bit-rate limits of the CAN bus interface. I know it will work at 500,000 bits per second. How fast can it go? Is there a lower limit?

Hi,

CANERR and CANSTBY pins supoort are not yet implemented in driver. It is okay to leave them( do not connect).
Bit-rate min is 500kbps and Max is 1Mbps

Thanks,
Shubhi

According to the Developer Kit Carrier Board schematic CAN0/1_STBY is bidirectional, and CAN0/1_ERR is an input signal to the SoM. How are these signals intended to be used in the future when they are implemented in the driver?

Also, it appears that pin E17 is reserved in the latest documentation. However, it is connected on the schematic as CAN0_STBY. Is E17 usable as a GPIO signal?

Hi JDSchroeder,

CAN0_STBY pin can be used as GPIO. I will look at it soon on how STBY and ERR pins can be used in future.

Thanks,
Shubhi

That would be great. E17 is not listed in the pinmux document so any additional details like which padconf/address to use to configure it and what the corresponding GPIO port/address to use for controlling it as a GPIO are needed.

Hi,

Sorry, my bad. I just checked E17 pin is not connected anywhere in CVM of Jetson-TX2. That’s why, it is not given in pinkux document as well. Well generally CAN_STBY and CAN_EN pins are configured as GPIO and driver uses them in suspend/resume time to make chip active/inactive by controlling GPIO.

Thanks,
Shubhi