Some suggestions on troubleshooting CAN interface

Working on enabling CAN based on articles and github, but not sure how to confirm it is enabled.


When it talks about loopback test, does that mean to acutally enable it in the CAN software, but also connect the RX/TX (PIN 29, 31 for CANO)?

I thought by the design of the system would let me loopback and see what the TX is sending?

Any other suggestions?

I am probing PIN 31 and Ground and PIN 29 and Ground, but not seeing any signals between the XAVIER and the Transciever. Makes me think something isn’t enabled.
According to the forums, there are two methods to enable CAN: 1. Flash it, 2: change the registers on each boot.
I have done the 2nd method and have not seen any signals from the Xavier.

Help!

user@machine:~$ dmesg | grep -i can

[ 0.000000] OF: fdt:memory scan node memory, reg size 48,
[ 1.528299] tegra-pwm 3280000.pwm: PWM clk can sleep in ops
[ 1.528728] tegra-pwm c340000.pwm: PWM clk can sleep in ops
[ 1.529294] tegra-pwm 32c0000.pwm: PWM clk can sleep in ops
[ 1.529896] tegra-pwm 32f0000.pwm: PWM clk can sleep in ops
[ 2.009601] FAN: can’t find tach_gpio
[ 46.463066] can: controller area network core (rev 20120528 abi 9)
[ 46.481049] can: raw protocol (rev 20120528)
[ 46.500554] CAN device driver interface
[ 46.512440] net can0: mttcan device registered (regs=ffffff800dc39000, irq=68)
[ 46.526476] net can1: mttcan device registered (regs=ffffff800fd6d000, irq=69)
[ 46.544299] mttcan c310000.mttcan can0: bitrate error 0.2%
[ 46.544443] mttcan c310000.mttcan can0: Bitrate set
[ 46.544456] mttcan c310000.mttcan can0: bitrate error 1.0%
[ 46.562242] mttcan c320000.mttcan can1: bitrate error 0.2%
[ 46.562380] mttcan c320000.mttcan can1: Bitrate set
[ 46.562391] mttcan c320000.mttcan can1: bitrate error 1.0%
[ 46.579542] mttcan_controller_config: ctrlmode 30
[ 46.579577] mttcan c310000.mttcan can0: Bitrate set
[ 46.595333] mttcan_controller_config: ctrlmode 30
[ 46.595367] mttcan c320000.mttcan can1: Bitrate set
[ 72.884007] mttcan c320000.mttcan can1: Bit0 Error Detected
[ 72.884186] mttcan c320000.mttcan can1: IR 0x8010000 PSR 0x71d
[ 72.884321] mttcan c320000.mttcan can1: entered error warning state
[ 72.884431] mttcan c320000.mttcan can1: entered error passive state
[ 72.884539] mttcan c320000.mttcan can1: Bit0 Error Detected
[ 72.884639] mttcan c320000.mttcan can1: IR 0x9800000 PSR 0x76d
[ 72.884759] mttcan c320000.mttcan can1: Bit0 Error Detected
[ 72.884862] mttcan c320000.mttcan can1: IR 0x8000000 PSR 0x77d
[ 72.885001] mttcan c320000.mttcan can1: entered bus off state
[ 72.885102] mttcan c320000.mttcan can1: Bit0 Error Detected
[ 72.885204] mttcan c320000.mttcan can1: IR 0xa000000 PSR 0x7e5

So, I started tracing my steps and started from the beginning because I have to believe that the interface on the Xavier AGX dev kit works.
So, with the scope connected i went to enable the registers for CAN and started with the loop back.
Question, it doesn’t appear to have to actually be physically connected for the loopback to work? The driver can listen to itself? So, removed the jumper for CAN RX and CAN TX but sent some messages to the CAN Transciever, and saw some data go across the bus. WOOHOO!!
I also switched some things on my transceiver, like using the interface that was actually connected. HA! But it appears that maybe my transceiver was acting up, but the CAN H and CAN L were showing some transmissions but the data was way bad and noisy. So, I am ordering some new transceivers to make sure it was me.
I will provide update once complete.

Yeah, its better you get reliable transceivers that support data rate of atleast 125kbps. Are you sure, you set up the CAN on Jetson properly ?

Everytime you wanna start using the CAN on Jetson, do configure it everytime with something like

sudo ip link set down can1
sudo ip link set down can0
sudo busybox devmem 0x0c303000
sudo busybox devmem 0x0c303010
sudo busybox devmem 0x0c303008
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 up type can bitrate 250000 sjw 127 dbitrate 2000000 dsjw 15 berr-reporting on fd on
sudo ip link set can1 up type can bitrate 250000 sjw 127 dbitrate 2000000 dsjw 15 berr-reporting on fd on
sudo ip link set up can0
sudo ip link set up can1
ip -s -d link show can0
ip -s -d link show can1

The magic here is:sudo ip link set can0 up type can bitrate 250000 sjw 127 dbitrate 2000000 dsjw 15 berr-reporting on fd on… this was what saved me from ever-lasting troubles. Do read on it.

1 Like

I’m pretty sure I had a quality transformer just might have been bad luck with this particular one. I’ve ordered more to be sure. This is the one I used: Copper hill tech isolated 3v3 can bus transceiver.

I thought I followed those steps every time but not sure since it didn’t work and now it seems. Going to try again today to make sure I get to the same point to verify Xavier is setup correctly but gonna be a couple of days until parts arrive.

Walter

1 Like

Alright, 100% user error with the transceiver. I had to solder the jumper for the 120Ohm resistor. I know, i know, you gotta terminate the ends.

As for the rest, i am not sure, but seems that following your steps and the steps from the medium article and from the github seem to work great now! so strange. i was definitely getting some errors initially, but i can successfully recreate and send CAN messages.
So, thanks a ton for the assist and reminder, all is working now!

1 Like

Kudos !