Unable to get Jetson CAN interface to work

Hi

I’ve been following this guide trying to get the CAN interface to work – no luck.

I see the devices in /proc/device-tree/..., i can memset the values into the registers (tho i use memset without busybox – but AFAICT this shouldn’t be a problem), i load the kernel modules, create the network devices with ip but i’m unable to get the loopback test to run. Pinmux has been adjusted to work with CAN GPIO ports.

Erronous behaviour shows itself as follows:

  • after a couple of cansend commands i get a “write: No buffer space available” error message – none of the messages are received

meanwhile dmesg is filled with messages like these:

[ 683.464785] mttcan_handle_bus_err: 47958 callbacks suppressed
[ 683.464875] mttcan c310000.mttcan can0: Acknowledgement Error Detected
[ 683.465339] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x76b
[ 683.465524] mttcan c310000.mttcan can0: Acknowledgement Error Detected
[ 683.465719] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x77b
[ 683.465887] mttcan c310000.mttcan can0: Acknowledgement Error Detected
[ 683.466102] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x77b
[ 683.466278] mttcan c310000.mttcan can0: Acknowledgement Error Detected
[ 683.466444] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x77b
[ 683.466620] mttcan c310000.mttcan can0: Acknowledgement Error Detected
[ 683.466784] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x77b
[ 687.467946] mttcan c310000.mttcan can0: bitrate error 0.2%
[ 687.468257] mttcan c310000.mttcan can0: Bitrate set
[ 693.272853] mttcan_controller_config: ctrlmode 31
[ 693.272956] mttcan c310000.mttcan can0: Bitrate set

Detailed list of steps i made:

  1. configure jetson-io for GPIO CAN pin usage
  2. cat /proc/device-tree/mttcan@c310000/status
    • “okay”
  3. installed devmem2
  4. devmem2 0x0c303018 w 0x458
  • pinmux can0 DIN
  1. devmem2 0x0c303010 w 0x400
  • pinmux can0 DOUTM
  1. modprobe can
  2. modprobe can_raw
  3. modprobe mttcan
  4. ip link set can0 up type can bitrate 500000 dbitrate 1000000 berr-reporting on fd on

Thanks in advance for any input. Did i miss something? Did i misinterpret your guides/tutorial?

hello wicg,

may I know which JetPack release you’re using? had you perform a loopback test?

JetPack version ``5.0.2-b231 is installed.

I tried the loopback test but failed. When measuring electronically we can see the CAN messages being sent but the driver seems unable to receive (or even ACKnowledge) the messages.

hello wicg,

before you insert CAN BUS subsystem support module, and Raw CAN protocol module.
did you enable kernel support for mttcan? you should configure deconfig to change CONFIG_MTTCAN = m, so mttcan is compiled as a module

besides,
are you able to check the interface statistics?
for example,
ip -details -statistics link show can0
ip -details -statistics link show can1

as described in my first message, i load mttcan (as a module​) with the command modprobe mttcan​. since i get no error and see the module being loaded (i check with lsmod | grep can​) i’m positive the kernel can load the mttcan​ module. or did i misinterpret your question?

do i actually need to compile the kernel myself (as hinted by you with your defconfig comment)?

also: i can see ip -details -statistics link show can0
it prints (before trying to send):

11: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can <BERR-REPORTING,FD> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
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
dbitrate 1010526 dsample-point 0.736
dtq 52 dprop-seg 6 dphase-seg1 7 dphase-seg2 5 dsjw 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 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

and after the (unsuccessful) attempt to send and receive on can0:

11: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can <BERR-REPORTING,FD> state ERROR-PASSIVE (berr-counter tx 128 rx 0) restart-ms 0
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
dbitrate 1010526 dsample-point 0.736
dtq 52 dprop-seg 6 dphase-seg1 7 dphase-seg2 5 dsjw 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 18418 0 1 1 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
147360 18420 18418 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks

Hi

No, the issue is not resolved. We’ve been able to confirm that CAN Bus 0 does NOT work on Jetson Xavier AGX machines. The TX Pin does not seem to be able to drive sufficient voltage differentials, as you can see in the image attached.


On top is the differential line driven by an external converter; since the TX pin (seen on bottom) only achieves a differential of 1.6V the converter cannot generate the desired differential signal.

We were able to reproduce this with a second Jetson Xavier AGX.

I suspect a driver issue.

Hi,
How have you tested loopback?
For loopback test, you do not need any connections
and just need to set “loopback on”.

as i had written before, i followed your instructions and tried a loopback test.

what do you mean with ‘set “loopback on”’ ? on the interface? with a ip link set command?

Sorry for the late response, is this still an issue to support? Thanks

yes

Did you figure it out? I am having the same problem