Nvidia NX can0 GPIO Pins Not Working

I have been attempting to get the CAN up and running on the Xavier NX, currently running Ubuntu 20.04, and it has not been successful. I know messages are getting to the transceiver and that that transceiver is working (I have two nodes and swapped the two transceivers around to make sure they were working).

Setup:

  • SN65HVD230 Transceiver board x 2
  • Teensy 3.2 Spouting CAN messages at the 50000bps Rate
  • Xavier NX with J17 connected to the transceiver as follows:
    pin 31 → CAN TX
    pin 29 → CAN RX
    pin 17 → 3.3V
    pin 39 → GND

Procedure and Tests

  1. On a clean boot (of Ubuntu 20.04 - may be a possible cause) I run the following commands:
    sudo busybox devmem 0x0c303020 32 0x0000C458
    sudo busybox devmem 0x0c303018 32 0x0000C400
    sudo modprobe can
    sudo modprobe can_raw
    sudo modprobe mttcan
    sudo ip link set can0 type can bitrate 50000 restart-ms 1000 loopback off
    sudo ip link set up can0
    candump -d can0
  2. I power on the teensy and no messages appear.
  3. I take the voltage of the CAN0_DOUT pin and it is sitting at around 0V stopping the teensy publishing onto the CAN. As soon as I remove the connection of the CAN0_DOUT pin on the transceiver, messages are clearly visible on the CAN RX pin of the transceiver, but nothing is shown on candump.
  4. Ouput of ip -s -d link show can0:

6: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 1000
bitrate 50000 sample-point 0.875
tq 147 prop-seg 59 phase-seg1 59 phase-seg2 17 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 34000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
5. I take can0 down and turn on loopback, run cangen can0 and messages appear on candump.

I have tried using multiple different memory addresses, but so far nothing has worked. The ones I am currently using I obtained from here: https://docs.nvidia.com/jetson/l4t/#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/hw_setup_jetson_can.html#wwpID0E02D0HA

I had a look at the kernel and it appears that there is no mttcan_ivc in the /lib/modules directory, could this be the cause? I have no experience of building kernels so I am hoping that this isn’t the issue.

hello sreade123 ,

could you please have a try to change the parent clock,
please check device trees,
please update mttcan node clocks section and pll-source as pllc for verification.
thanks

Hello JerryChang,

Thank you for the reply. I checked the clocks and they were all fine (parent was osc and device tree showed pllc).
Turns out that I just needed to read the documentation. I was using the Xavier AGX pins for the CAN (on J12 header) and not the NX’s separate J17 header. Took me a while to notice and you need to take off the module from the carrier board to solder on the pins, but works great now.
I also did not need to change the pinmux, it worked with the following commands on startup:
sudo ip link set can0 type can bitrate 500000 restart-ms 1000 loopback off
sudo ip link set up can0

Thank you

Correction:
Still needed to run the modprobe commands on start-up:
sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan