No Communication Over CAN Bus

Hello!

We are using our custom carrier board with Jetson TX2 and Jetpack 4.4.1.

On our custom carrier board, we have a transciever which connects to
D18_CAN0_RX
D19_CAN0_TX
pins of Jetson TX2.

CAN_H and CAN_L pin headers connected to transciever are present on carrier board.

We connect two TX2 running on our custom carrier board together using CAN_H and CAN_L pins to check if communication is healthy.

What we have done so far:

  1. Enabled mttcan@c320000 by switching status from “disabled” to “okay”.

mttcan@c320000 {
compatible = “nvidia,tegra186-mttcan”;
reg = <0x0 0xc320000 0x0 0x400 0x0 0xc321000 0x0 0x32 0x0 0xc322000 0x0 0x1000>;
reg-names = “can-regs”, “glue-regs”, “msg-ram”;
interrupts = <0x0 0x2a 0x4>;
pll_source = “pllaon”;
clocks = <0x10 0xd4 0x10 0xd5 0x10 0x214>;
clock-names = “can”, “can_host”, “pllaon”;
resets = <0x10 0x3d>;
reset-names = “can”;
mram-params = <0x0 0x10 0x10 0x20 0x0 0x0 0x10 0x10 0x10>;
tx-config = <0x0 0x10 0x0 0x40>;
rx-config = <0x40 0x40 0x40>;
status = “okay”;
linux,phandle = <0x175>;
phandle = <0x175>;
};

After enabling it, we could see “can0” on ifconfig output.

  1. Loaded CAN related modules:

modprobe can
modprobe can_dev
modprobe can_raw
modprobe mttcan

  1. Set can0 interface type can and set bitrate 500K:

ip link set can0 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on

Applied steps above to both. We are trying to send message from sender TX2 to reciever TX2:

From sender TX2:

cansend can0 123#DEADBEEF

From reciever TX2:

candump can0

We start candump and send message with the command above. But we cannot recieve any message on reciever.

We see error logs on senders dmesg after cansend command:

[ 194.371635] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.371672] mttcan c320000.mttcan can0: IR 0x8010000 PSR 0x71d
[ 194.371733] mttcan c320000.mttcan can0: entered error warning state
[ 194.371745] mttcan c320000.mttcan can0: entered error passive state
[ 194.371754] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.371763] mttcan c320000.mttcan can0: IR 0x9800000 PSR 0x76d
[ 194.371787] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.371796] mttcan c320000.mttcan can0: IR 0x8000000 PSR 0x77d
[ 194.371820] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.371828] mttcan c320000.mttcan can0: IR 0x8000000 PSR 0x77d
[ 194.371867] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.371876] mttcan c320000.mttcan can0: IR 0x8000000 PSR 0x77d
[ 194.371918] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.371926] mttcan c320000.mttcan can0: IR 0x8000000 PSR 0x77d
[ 194.371970] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.371978] mttcan c320000.mttcan can0: IR 0x8000000 PSR 0x77d
[ 194.372023] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.372033] mttcan c320000.mttcan can0: IR 0x8000000 PSR 0x77d
[ 194.372084] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.372092] mttcan c320000.mttcan can0: IR 0x8000000 PSR 0x77d
[ 194.372126] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.372134] mttcan c320000.mttcan can0: IR 0x8000000 PSR 0x77d
[ 194.372178] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.372248] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.372330] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.372400] mttcan c320000.mttcan can0: Bit0 Error Detected
[ 194.372476] mttcan c320000.mttcan can0: entered bus off state
[ 194.372502] mttcan c320000.mttcan can0: Bit0 Error Detected

Also can0 interface parameters changes on sender TX2:

Before cansend:

root@4-4-1:~# ip link show can0
9: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can

After cansend:

root@4-4-1:~# cansend can0 123#DEADBEEF
root@4-4-1:~# ip link show can0
9: can0: <NO-CARRIER,NOARP,UP,ECHO> mtu 72 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
link/can

In conclusion we cant communicate over CAN bus. How can we track down this issue?

Any help will be appreciated,
Thanks.

I see you have not made CAN interface up.
Refer doc: https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/hw_setup_jetson_can.html#wwpID0ELHA