Skip to content
Carlos Tojal edited this page Dec 5, 2023 · 2 revisions

Using CAN interface to USB in Linux

CAN is plug and play in Linux because it provides built-in drivers in the mainline version. Communication is done using SocketCAN, which is a Volkswagen contribution. Using SocketCAN, you can use regular sockets to communicate with a CAN bus.

There are some utils available which are usually findable in any distribution with the name “can-utils” to log data and send data from command line tools.

The Vector VN1630A does not work plug-and-play in Linux. PEAK PCAN-USB works.

After installing the “can-utils”, ensure the driver has been loaded or just restart your computer (too lazy to search the name of the module to load, look it up).

Verify the interface is present using:

ip link ls

You should see the "can0" interface present with the down state.

Now you have to configure the CAN bitrate and turn the interface up.

Ensure the pinout of the cable you are using is compatible (PCAN pinout and D-sub pinout).

Consult the electronics department regarding the bitrate of the CAN bus you are willing to connect to. The value appears below in “bits” (i.e. 1Mbps = 1 million).

sudo ip link set up can0 type can bitrate 1000000

Now, use this command to view the data:

candump can0

At this point, the interface should be ready to work with the bridge.

Clone this wiki locally