Problems with CAN communication on Jetson AGX Orin Dev kit

Hello,
I am having big problems with CAN communication on Jetson Agx Orin. I am sending can messages from Advantech computer and on Jetson I get bad ID ( 88 or 4) and message although I should receive ID 100. I have tried others ID too, but I am getting 88 or 4. Is this some ID generated by Jetson? Why I am not getting ID and message which I send?
Jetpack 5.1.2

Hi marinkovicivan,

Are you using the devkit or custom board for AGX Orin?
What’s your Jetpack version in use?

Could you share the full commands you used and the results starting from setup CAN?

Have you verified with internal loopback test? Is there the same issue(wrong ID received) with loopback test?

Hi @KevinFFF ,

I am using Jetson Agx Orin 64gb Dev Kit. Jetpack version is 5.1.2.
What is very strange to me is that I am receiving another id and message from what I sent. ID of these messages are 88 or 4. Is it possible that these are some CAN error messages generated by Jetson?

I’ve not hit this issue on the devkit so that I need the exact commands you used to reproduce the issue and I could verify it locally.

Please provide the above information.

On Jetson, I do the following: sudo ./can_enable.sh, where can_enable,sh contain following:

sudo busybox devmem 0x0c303000 32 0x0000C400
sudo busybox devmem 0x0c303008 32 0x0000C458
sudo busybox devmem 0x0c303010 32 0x0000C400
sudo busybox devmem 0x0c303018 32 0x0000C458
sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan
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
sudo ip link set up can0
sudo ip link set up can1

echo “CAN Networking Enable”

exit 0

I use following code to receive CAN messages on Agx:

import can
bus=can.interface.Bus(bustype=“socketcan”, channel=“can0”, bitrate=500000)
try:
while True:
prijem=bus.recv()
print(‘received’, prijem)
except KeyboardInterrupt:
pass
bus.shutdown()

I use the following code to send CAN messages on Advantech:

import can_module
import time

can1=can_module.open_can(1,500)
can2=can_module.open_can(0,500)

def write_can(idx, length, messages):
try:
idx,messages= can_module,write_can(can1, idx, messages)
except:
print(’ Write CAN error’)

def write_can2(idx, length, messages):
try:
idx,messages= can_module,write_can(can2, idx, messages)
except:
print(’ Write CAN error’)

i=0
while i<=255:
data=[i, 0, 0, 0, 0, 0, 0, i]
id_1=0x120
id_2=0x130
write_can(id_1, 8, data)
print(f"CAN1 Sent: {hex(id_1)}-{data}“)
write_can2(id_2, 8, data)
print(f"CAN2 Sent: {hex(id_2)}-{data}”)
time.sleep(0.01)
i+=1

Hi @KevinFFF
It seems that the message I receive with ID 88 or 4 is because berr-reporting is on. Am I right? When I add other device on canhub, they don’t receive ID 88 or 4.
Can message is 00 00 02 (or 04 or 16) 00 00 00 00 00… what does this error message mean?

Hi @KevinFFF,
In addition to above problem, I have added another device which send CAN messages. On Advantech, it receive right message and ID. On Agx Orin, I receive ID 88 and message is not good. What can cause this?
Can it be something connected to CAN clock rate?

According to Controller Area Network (CAN) — Jetson Linux Developer Guide documentation? , CAN clock can be checked with cat /sys/kernel/debug/bpmp/debug/clk/can0/rate but when I go to cat /sys/kernel/debug/bpmp/debug/clk where is no can0 folder ( only can 1 and can2).

According to same source, CAN clock rate should be 50Mhz but when I check cat /sys/kernel/debug/bpmp/debug/clk/can1/rate I receive 200Mhz.

Can this cause that I receive CAN error message, while on other devices I receive ID and message that I should?
Hope to see your earlier response as this is very urgent.

Hi @KevinFFF,
Addition to previous mail, when Advantech receive the message and if I forward it to Jetson, I receive valid CAN message on Agx. Can you provide now information why I don’t receive message on Jetson when I read it without forvarding?

Sorry for the late reply.

Could you share the block diagram of your connections?

I would suggest simply connecting 2 boards and verify CAN communication first.
Please refer to the following steps to setup CAN.

1. load kernel module
$ sudo modprobe can
$ sudo modprobe can_raw
$ sudo modprobe mttcan

2. Setup can0
$ sudo ip link set can0 up type can bitrate 100000

3. Send/Receive test
$ candump -x any &
$ cansend can0 123#abcdabcd

4. Check status
$ sudo ip -d -s link show can0

Hi Kevin,



When I try your above commands, I don’t receive any CAN message on Advantech computer.

If I do this:
sudo busybox devmem 0x0c303000 32 0x0000C400
sudo busybox devmem 0x0c303008 32 0x0000C458
sudo busybox devmem 0x0c303010 32 0x0000C400
sudo busybox devmem 0x0c303018 32 0x0000C458
sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan
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
sudo ip link set up can0
sudo ip link set up can1

and then cansend can0 123#11223344, I receive this CAN message sent from Jetson terminal to Advantech.

As per attached image, Advantech is connected to canhub (can repeater) and Jetson is connected to canhub too.

Okay, you have to configure the pinmux register for CAN before using.

From your image, I’m still not clear about your connections.
Could you share a simple block diagram of your connections?

It seems you could send/receive the CAN packet on your setup.
Could you also help to clarify and state what’s your current issue?

Current issue as same as at the start.

I send some CAN messages on canhub where Advantech is connected too. Advantech receive CAN message that was sent from Jetson Agx Orin, do some calculation and return CAN message on canhub. When I am receiving that message on Orin, I receive wrong ID and message.
ID that I receive is 88, and as I asked before, since berr-reporting is on. is this some local CAN message generated by Orin which inform me that CAN message is not good? I can’t see any other explanation since ID and data are totally different from what I sent.
If I add another Advantech device to canhub to listen returning message from first Advantech device, CAN message is good and ID is good too so second question is why I don’t receive regular message ID and data when reading CAN message with Orin?

Orin should not generate the CAN messages.

Could you just verify to connect 2 devices (maybe 2 AGX Orin Or Orin+Advantech) directly w/o canhub?
Or the issue is specific to canhub?

When berr reporting is not activated, I don’t receive any CAN message on Orin. When its set on, I receive wrong id and data ( ID is 88 every time). This is why I believe this is generated by Orin and inform that there is some problem with CAN message.

Orin and Advantech are both connected to canhub. Advantech receive CAN messages, while Orin receive this bad messages if berr-reporting is on or not receive messages at all if berr-reporting is off.

Could you reproduce the wrong ID and data issue when you connect Orin and Advantech directly and with berr-reporting enabled?

If so, please share the reproduce steps so that me could get 2 Orin devkit to verify locally.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.