CAN communication on Drive AGX

Hardware Platform: DRIVE AGX Xavier™ Developer Kit
Software Version: DRIVE Software 10
Host Machine Version: native Ubuntu 18.04
SDK Manager Version: 1.0.1.5538

Where can I find the documentation on building the CAN loopback cable for the NVIDIA Drive Xavier AGX? I found this section that has a picture and references the instructions:
https://docs.nvidia.com/drive/drive_os_5.1.6.1L/nvvib_docs/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide/System%20Programming/sys_components_tegra_can.html#wwpID0E0AF0HA

This section mentions a “special loopback cable with termination to test CAN” and recommends consulting the CAN_Loopback Cable Build Instructions" and has a photo of the cable. From the photo, I see that the 120ohm resistor is on one end of the cable only. Can someone confirm that? I tried to use a regular CAN loopback cable with 120ohm termination at both ends to test the SocketCAN interfaces. As soon as I connect the loopback cable, I see bit stuff errors from the MTTCAN driver, which points to an improper termination on the cable.

If needed, I will try to gather the error output by re-connecting the CAN loopback cable.

Hi AnishAney,

The loopback cable referenced is a documentation error and we will work on correcting it. For loopback via can, you should be able to connect CAN H to CAN H, and CAN L to CAN L for the nodes you want to connect together. You’ll also need a terminator resister(120 ohm is good) between H and L.

Can you share more details on how you configured the cable you are using? Which Pins of the DB9 you are connecting on the vehicle harness, and your software/test configuration?

Thanks!

Thanks for the clarification, Luke! After posting the question, I came across the following thread discussing the pinout of the DB9 adapter:

Based on Steve’s reply (CAN connector pinout) in the above post and looking at the labels on the adapters, I am assuming that ‘x’ is the first of the two controller numbers, and ‘y’ is the second. I.e., on the CAN1_2 adapter, x=1, y=2. And similarly, on the CAN6_4 and CAN5_3 adapters as well.

I am interested in running loopback tests. I tried to use two cables (one at a time) between CAN1_2 and CAN6_4 adapters. One was wiring pins 2, 7, and 3 from one end to the same pins on the other end with 120Ohm termination between CANH and CANL. Another was wiring pins 1-8 on one end to corresponding pins on the other (also with termination between CANH and CANL pairs). As soon as I would connect either of the cables, I would see bit errors related to the MTTCAN driver in dmesg. I was not transmitting any test at that point.

So, my another related question is:
Is CAN communication supposed to work between a SocketCAN port and a “regular” CAN port?

Hi AnishAney,

You are correct on the CAN controller numbering. Here is an example for reference:

CAN_1_2:
Pin 7 = CAN1 High
Pin 2 = CAN1 Low
Pin 8 = CAN2 High
Pin 1 = CAN2 Low

CAN_6_4:
Pin 7 = CAN6 High
Pin 2 = CAN6 Low
Pin 8 = CAN4 High
Pin 1 = CAN4 Low

The CAN architecture is a bit complicated on the system as some can ports can be routed to the Aurix MCU and/or the Xavier. Assuming you want to test SocketCAN on a Xavier based on your comments. Only CAN2 and CAN6 are directly accessible via Xavier and the others are only accessible via configuring a CAN bridging solution on the MCU. TegraCAN provides two SocketCAN interfaces that is associated with each of these two can ports.

I have not setup the loopback config you are attempting, but connecting between CAN2 and CAN6 should work to enable basic loopback testing. I think it might be possible the MCU Can ports connected to the Xavier ones might cause some trouble.

On my own bench setup, I am able to connect a PEAK CAN dongle to CAN_6_4(to access CAN6, which is “can1” from Drive OS/Xaiver). I can then use PCAN-View software on windows to transmit a test message. Here are the steps if it helps

SocketCAN should already be enabled in DRIVE OS, but if not use the following
$sudo ip link set can1 type can bitrate 500000
$sudo ip link set up can1

Use candump utility to view received messages
$candump can1

Use PCAN-View to transmit a test message, candump should then show the received CAN message
can1 123 [8] 00 01 02 03 04 05 06 07

Thank you, Luke, for the explanation. Can you please point me to some documentation/example related to the CAN bridging solution you referenced? I plan to run loopback tests with the CAN ports connected to the MCU (port numbers 1, 3, 4, and 5).