CAN Connection problems

Hello, I have a Jetson AGX Xavier and want to use the CAN ports to detect a CAN-supported motor, so I enabled the CAN ports by using

sudo /opt/nvidia/jetson-io/jetson-io.py

And using the GUI I enabled the CAN ports. I assume that this step replaces modifying the register values using busybox.

I connected the Xavier to a MCP2551 chip and added a 120ohm resistor across the CANL and CANH output of the chip. The CAN signals are then connected to the motor driver and connected the output of the driver (another CAN port) to another motor driver to act as a second node to form a CAN network. I setup the CAN interface with:

sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 500000
sudo ip link set up can0

When I try:
ip -details -statistics link show can0

It shows this:

7: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10000
    link/can  promiscuity 0 
    can state ERROR-PASSIVE (berr-counter tx 136 rx 1) restart-ms 1000 
	  bitrate 498701 sample-point 0.870 
	  tq 26 prop-seg 33 phase-seg1 33 phase-seg2 10 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 38400000
	  re-started bus-errors arbit-lost error-warn error-pass bus-off
	  0          0          0          1          1          0         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
    RX: bytes  packets  errors  dropped overrun mcast   
    16         2        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0

I tried cansend can0 220#50 and candump can0 but neither display any result.

When I run sudo dmesg | grep mttcan :

[  128.509237] mttcan c310000.mttcan can0: bitrate error 0.2%
[  128.509372] mttcan c310000.mttcan can0: Bitrate set
[  138.806412] mttcan_controller_config: ctrlmode 0
[  138.806438] mttcan c310000.mttcan can0: Bitrate set
[  181.949050] mttcan c310000.mttcan can0: entered error warning state
[  181.950352] mttcan c310000.mttcan can0: entered error passive state
[15088.480739] mttcan c310000.mttcan can0: entered bus off state
[15089.489832] mttcan c310000.mttcan can0: wait for bus off seq
[15089.501920] mttcan c310000.mttcan can0: entered error warning state
[15089.502088] mttcan c310000.mttcan can0: entered error passive state
[15089.502253] mttcan c310000.mttcan can0: entered bus off state
[15090.513777] mttcan c310000.mttcan can0: wait for bus off seq
[15090.527844] mttcan c310000.mttcan can0: entered error warning state
[15090.528000] mttcan c310000.mttcan can0: entered error passive state
[15090.528129] mttcan c310000.mttcan can0: entered bus off state
[15091.537749] mttcan c310000.mttcan can0: wait for bus off seq
[15091.551800] mttcan c310000.mttcan can0: entered error warning state
[15091.551958] mttcan c310000.mttcan can0: entered error passive state
[15091.552082] mttcan c310000.mttcan can0: entered bus off state
[15092.561700] mttcan c310000.mttcan can0: wait for bus off seq
[15092.573875] mttcan c310000.mttcan can0: entered error warning state
[15092.574041] mttcan c310000.mttcan can0: entered error passive state
[15092.574163] mttcan c310000.mttcan can0: entered bus off state
[15093.585684] mttcan c310000.mttcan can0: wait for bus off seq
[15093.599723] mttcan c310000.mttcan can0: entered error warning state
[15093.599879] mttcan c310000.mttcan can0: entered error passive state
[15093.600008] mttcan c310000.mttcan can0: entered bus off state
[15094.609662] mttcan c310000.mttcan can0: wait for bus off seq
[15094.623688] mttcan c310000.mttcan can0: entered error warning state
[15094.623857] mttcan c310000.mttcan can0: entered error passive state
[15094.623985] mttcan c310000.mttcan can0: entered bus off state
[15095.633631] mttcan c310000.mttcan can0: wait for bus off seq
[15095.647695] mttcan c310000.mttcan can0: entered error warning state
[15095.647861] mttcan c310000.mttcan can0: entered error passive state
[15947.670386] mttcan c310000.mttcan can0: bitrate error 0.0%
[15947.670517] mttcan c310000.mttcan can0: Bitrate set
[21155.876748] mttcan c310000.mttcan can0: bitrate error 1.0%
[21155.876880] mttcan c310000.mttcan can0: Bitrate set
[21269.734992] mttcan c310000.mttcan can0: bitrate error 1.0%
[21269.735123] mttcan c310000.mttcan can0: Bitrate set
[21357.069255] mttcan c310000.mttcan can0: bitrate error 1.0%
[21357.069394] mttcan c310000.mttcan can0: Bitrate set
[22071.707183] mttcan c310000.mttcan can0: bitrate error 1.0%
[22071.707313] mttcan c310000.mttcan can0: Bitrate set

I ran a code that detects the number of CAN devices connected and it showed me that no CAN devices were connected.

Any help would be appreciated.
Thanks.

Hi amrehab,
CAN from Xavier is recognized. You can see node from ifconfig can0 also.
But there are errors seen.
Are you using both CAN from Xavier? If not, what is the bitrate of other controller used?
Xavier CAN bitrate is 498701

I am using can0 ports (29 and 31) from the 40 pin configuration on Xavier and connecting them to a driver and connected the other port of the driver to another driver like a daisy chain. The driver has a bitrate of 1Mb/s and changing the bitrate of the CAN0 port to 1000000 on the Xavier didn’t help. Do I need to use can1 too? And if the answer is YES, where would CAN1 Din and CAN1 Dout be connected? Last question, do I need to connect more than one driver for the network to function properly or I can do it with just one driver?

Hi amrehab,
You do not need to use CAN1 of xavier if you do not need it. From xavier, if you set 1Mbps, you will see some bitrate error, it won’t exactly set to 1Mbps because of clock not to be pllaon.
Since other driver is working at exact 1Mbps, bitrate mismatches and thus you are not able to communicate. You can try setting pllaon on xavier and try to communicate.
Follow:
https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/clocks.html#wwpID0E06B0HA

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