How to use CAN of Jetson AGX Xavier to communicate with other device

Hello,
I bought a Jetson AGX Xavier the other day. We are mainly used to do CAN communication with robots. Once I got my hands on it, I followed the instructions on the webmaster’s blog, only to find that I could only use loop-back mode on the machine.
When I connected Xavier and TX2 with two CAN transceivers, I couldn’t get the data or send it out. Later, I replaced TX2 with other devices, such as raspberry PI, STM32 and other devices with CAN interface, they still can’t communicate with each other.

Hi lixiang,
Can you check this post and see if you have enabled CAN on Xavier properly:


You have to update pinmux for the pins you are using.
You can do so by updating cfg and reflash or by using busybox devmem tool to directly write to HW registers.
Let me know if you are facing any issues.

Thanks,
Shubhi

Hi,
I configured Xavier by following the following steps:

  1. First install a tool to change register values on Xavier:

    Sudo apt install busybox

  2. Then we need to reconfigure the four register values corresponding to the CAN controller pins.The following command will reconfigure these pins:

    sudo busybox devmem 0x0C303000 32 0x0000C400
    sudo busybox devmem 0x0C303008 32 0x0000C458
    sudo busybox devmem 0x0C303010 32 0x0000C400
    sudo busybox devmem 0x0C303018 32 0x0000C458

  3. Use the following modprobe command to install CAN controller and load the driver:

    sudo modprobe can
    sudo modprobe can_raw
    sudo modprobe mttcan

  4. I set the CAN bit rate to 500 Kbps, enabled flexible data rate (FD), set the payload bit rate to 2 Mbps and enabled bus error reporting.

    sudo IP link set can0 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
    sudo IP link set can1 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on

  5. Start CAN interface:

sudo IP Link set up can0 
sudo IP Link set up can1

When I connected to the Elmo drive with Xavier, The instructions could not be sent out and the data returned by the ELmo drive could not be received. Then I tried other embedded boards, but still could not communicate with CAN.
Later, I tested the loopback mode again. I opened the Can0 monitoring window through “Candump Can0”, and then opened a new terminal to execute “Cansend Can0 123#12345678”. The data could be received: “Can0 123 [4] 12345678”.
But if I execute this command a few more times, Xavier sometimes reboots

Hi,
Can you paste logs when system reboots? logs from the starting when you are sending and system starts to boot. Also, how frequently is it happening? and which BSP version you are using? Please provide some more details of the issue.

Thanks,
Shubhi

I’ve tried many times recently, and Xavier hasn’t rebooted, so there’s no way to provide a system log.
Xavier was not able to communicate with other devices. I would like to ask if there are any configuration errors in those steps I sent before.
Why can’t it communicate with other devices? Is there any solution。
REVISION: 4.2, GCID: 20074772, BOARD: t186ref, EABI: aarch64

Hi,
I don’t see any error with your steps. But you need to provide more information, where it got stuck. Maybe flash the device again and check debug logs.

Is it possible that there is a hardware failure? Do you think it is necessary to return to the factory for repair.

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Not really sure, have you flashed the device again and checked debug logs?