There’s a previous thread that suggests that the CAN port drivers don’t properly load in Jetpack 27.1, and we have to wait for the next release to actually be able to talk to the CAN hardware.
It may be that we actually have all the bits and pieces available to talk CAN on the current version of Jetpack; we just haven’t found any documentation from NVIDIA on how to do it.
When you can talk to the CAN hardware, that hardware is more of a network and less of a raw pipe, so it won’t work exactly like a serial port. Instead, check out SocketCAN for Linux.
See if you can make it work using modprobe:
sudo modprobe can can_gw can_bcm can_raw can_dev slcan vcan
I can confirm that I am able to send data across a CAN bus from the TX2 to a separate board. You will need the transceivers of course at each end. I am using a small board with a pair of TI SN65HVD257 transceivers on it (along with required external components). Sending data with the Linux SocketCAN interface is relatively easy as can be seen in the documentation at https://www.kernel.org/doc/Documentation/networking/can.txt. Note that I haven’t done much testing with this setup yet as I just started working on it yesterday, but it does seem possible.
Aside: one can use sigrok and pulseview (both free) and a $20-40 set of chips and cables to perform real-time signal analysis WITH protocol translations, even on a lowly RPi but can store way more points (into the billions) with a desktop. There are dozens of protocols this software can handle, including rs232 serial, of course, and I2C, SPI, and CAN, of today’s popular ones. So you can use those tools to verify the signals between the TXx’s and the targets.
Basically, it is a software-defined logic analyzer of tremendous capability. For $20-40.
It’s just a bit of busy work. You have to edit the kernel configuration and install the new kernel and modules on your TX2 board somehow. In my case, I edited the kernel configuration then just copied the Image file, modules and dtbs over to the board. Then I rebooted it and saw my new kernel was running.
The following thread has some information on how to do this.
However I also found the documentation to be very helpful. In the following download there is a file nvl4t_docs\Tegra Linux Driver Package Development Guide\l4t_getting_started.html, which contains a section titled “Building the NVIDIA Kernel”. You will want to follow these instructions very carefully.
Once you have the kernel built with CAN support, you will need to load the driver modules. Since I am going to use raw CAN, the following is all I needed. You might need other modules depending on what you are doing.
sudo modprobe mttcan
sudo modprobe can
After that you should be able to see the CAN interfaces with the ‘ip link’ command. If you can see them listed, then you can configure them and bring them up:
sudo ip link set can0 type can bitrate 1000000
sudo ip link set up can0
Now you can take a look at the Linux SocketCAN documentation I pointed to earlier in the thread for how to create sockets which can be used to communicate over the CAN bus.
Hi, I have add CONFIG_MTTCAN=m to open can0 & can1 in kernel;
I also add below code in dtsi file to open relationship between can controller and IO port :
if you mean that you build kernel in Liunx PC, and it will produce Image, dtb and modules lib, and you just copy it to the TX2, I want to know the complete direction of your copy, thanks
If you are asking for complete instructions on how to copy the kernel image, dtb and modules from the Linux host to the TX2, unfortunately I won’t be able to send that. I would really suggest reading the “Building the NVIDIA Kernel” section of the documentation I linked to in the post you quoted. It shows you where all the files are placed after building the kernel, and from there I think it is straightforward to copy them over to the TX2.
Hi, I am also trying to get the CAN socket working on the Jetson TX2. I am running from Jetpack 3.3, do I still need to install a driver for the CAN interface?
Currently, I would just like to know how I can view the available CAN interface ports from my computer.