Enable CAN on Xavier

If you’ve already enabled CAN on your Xavier and the IMU device is properly connected to the CAN bus, you can simply use the following command in terminal to check if you’re receiving CAN traffic:

candump can0

Here I’m assuming you’ve setup your CAN device as can0 and can-utils is installed on your Xavier (https://wiki.linklayer.com/index.php/SocketCAN).

Thanks Ramin for your reply. I actually did but I am not seeing anything. Is it possible that the bitrate that I setup is not compatible with the sensor? I used this ‘sudo ip link set can0 type can bitrate 1000000’
Here is what I found in the user manual of the sensor
“The CAN message uses standard 11 bits identifier and 8 bytes of data.
The default connection baud rate is 125Kbit/s.”
Also here is a copy of quick user manual of the sensor (https://www.lp-research.com/wp-content/uploads/2017/11/LpmsCanal2QuickStartGuide20171027.pdf)

CAN bitrate should be set to 125Kbit/s if that’s what your sensor baud rate is:

sudo ip link set can0 type can bitrate 125000

You also need to bring your can0 interface up:

sudo ip link set up can0

and make sure the interface is up by the ifconfig command. You should see the can0 device and its settings in the output.

I did what you said but still nothing comes up when I do ‘candump can0’
I also check the hardware setup multiple time and I am pretty sure the wiring is correct.

Here is when I run ‘ip -s -d link show can0’

7: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 125000 sample-point 0.875
tq 40 prop-seg 87 phase-seg1 87 phase-seg2 25 sjw 1
mttcan: tseg1 2…255 tseg2 0…127 sjw 1…127 brp 1…511 brp-inc 1
mttcan: dtseg1 1…31 dtseg2 0…15 dsjw 1…15 dbrp 1…15 dbrp-inc 1
clock 50000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0

Here is when I run ‘ifconfig’

can0: flags=193<UP,RUNNING,NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 65

Okay just checked the cable connected to sensor and now it works. Thanks so much.

I was about to ask you to check the wiring :) good to hear its working now.

Hi everyone,

As far as I know, Jetson has two CAN bus terminals CAN0 and CAN1. Is it possible to use only one CAN bus (CAN0) with multiple sensor entries? For example, assume I have two IMUs and I am going to connect them to CAN0 only. I think the hardware setup would be as follows

Rx_j ------- Jetson ----- Tx_j
Rx_imu1 ----- IMU1 ------ Tx_imu1
Rx_imu2 -------IMU2 ------ Tx_imu2

All the IMUs Rx are connected to Jetson Rx and similarly all the IMU Tx are connected to Jetson Tx.
But how can I assign a specific ID to each IMU CAN? For example, when I run “candump can0”, how to see what data come from which sensor?

@seyed.fakoorian

You can join as many sensors as you want to one can port (CAN0), but everyone (read and send) on CAN0 has to have the same baudrate.

Regarding CAN id of devices, unless you can have access directly to the IMU firmware somehow to set it, this information is usually set by default by the manufacturer (should include in the device manual or info on their webpage). Some device may automatically claim a different address if the default address is already claimed on the bus, but best is to read the sensor manual to know this information.

hello,
i followed this topic and the github readme referred earlier, but i got no success on loading the can drivers.
i got the following error:

insmod: ERROR: could not insert module /lib/modules/4.9.108-tegra/kernel/drivers/net/can/can-dev.ko: Invalid module format

or:

nvidia@jetson-0423418010460:~$ sudo modprobe can
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.9.108-kastner/modules.dep.bin'
modprobe: FATAL: Module can not found in directory /lib/modules/4.9.108-kastner

can you please give me some hints?

Linux jetson-0423418010460 4.9.108-kastner #3 SMP PREEMPT Thu Jul 11 15:22:26 CEST 2019 aarch64 aarch64 aarch64 GNU/Linux

i solved the problem by installing the Jetpack 4.3, after that everything went smooth without any errors

I bumped into this question while trying to figure out how to connect Custom IMU to Driveworks. I am trying to connect the IMU_CAN interface and run ./sample_can_interpreter using a real CAN device.
My problem is I am using slcand and not able to configure it right. The transceiver I am using is CANalyst-ii which is USB-CAN. Usb connecting to the host. This device doesn’t have documentation to work with linux but from other online resources (mainly this link: https://nick-black.com/dankwiki/index.php/CANalyst_II) I got to the point where I can see slcan0 when in ifconfig.

slcan0: flags=193<UP,RUNNING,NOARP>  mtu 16
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 1
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

When i do candump slcan0, i see the cursor blinking and not printing anything. I am prety sure CAN IMU is sending out data. Because I am able to do the candump can0 in my raspberrypi (using pyCAN board there). Maybe this is a bit rate issue. CAN device baudrate is 250000.
I used following commands to get this far,

sudo modprobe can

**pi@raspberrypi** : **~ $** sudo modprobe can-raw

**pi@raspberrypi** : **~ $** sudo modprobe slcan

**pi@raspberrypi** : **~ $** sudo modprobe usbserial vendor=0x04d8 product=0x0053

**pi@raspberrypi** : **~/Documents/CAN-TEST_PI2/can-test_pi2 $** sudo slcand -o -s5 -t hw -S 2500000 /dev/ttyUSB0

**pi@raspberrypi** : **~/Documents/CAN-TEST_PI2/can-test_pi2 $** sudo ip link set up slcan0

**pi@raspberrypi** : **~/Documents/CAN-TEST_PI2/can-test_pi2 $** ./candump slcan0

Trying to get candump work in my Rpi before I make it work with DriveWorks.

Maybe this is not the right thread to post this but clearly you guys know more than I thought posting here might help. Let me know if you want me to create a new post.
Thanks in advence.

Regrds,
Rishit

Hi Rishit,

Please open a new topic. Thanks

Hello all,
I am trying to enable can on Xavier , CAN on Xavier send data and received by another can controller ,but when the other controller send me nothing recieved by the CAN on Xavier .
Could any one help?

Hi essamamr,

Please open a new topic. Thanks

Hello this should be helpful for you.
Check the connections and follow the instructions in it.

1 Like

hi, spatra, I found a serious issue. CAN-BUS function enable successfully only when I use JetPack4.4, I try to flash JetPack4.5 or higher version, it can’t be used

Hello,

I have the same problem related to CAN and various JetPack versions.
It is also working for me with JetPack version 4.4 but does not work under JetPack 4.5.1.

Did you found some sort of solution for this issue?

Hi Guys,

Please check this issue, we have a customer which ungraded to JP4.5.1 and CANbus stop work for him. Under JP4.4 it works fine. This is urgent.

Hi,

An update.
We managed to solve it. Solution is here:

1 Like