This is the adapter-specific branch of CAN 02: Bring Up a CAN Interface on Linux. Start here when a PEAK adapter does not appear as a CAN interface, or when an application explicitly requires PCAN-Basic.
Check native SocketCAN support first
For a PCAN-USB or PCAN-USB FD adapter, inspect the USB device and try the mainline USB driver:
lsusb
sudo modprobe peak_usb
ip -brief link
If a CAN interface appears, return to CAN 02's interface configuration. You can use SocketCAN without compiling PEAK's separate driver package. When no interface appears, inspect sudo journalctl -k -b for driver binding or firmware errors and check support for the exact adapter and running kernel.
PEAK-System PCAN interfaces are widely used in robotics and industrial automation. On Linux, there are two main software paths:
- SocketCAN (
netdev) exposes the adapter as a Linux CAN network interface such ascan0. - PEAK's character-device driver (
chardev) exposes PEAK-specific device nodes and supports APIs such as PCAN-Basic.
Many PEAK USB and PCI interfaces are already supported by the mainline Linux kernel. If the application uses SocketCAN, first check whether the adapter appears with ip link; installing PEAK's out-of-tree driver may be unnecessary.
When chardev Is Useful
- PCAN-Basic compatibility: PEAK's Linux PCAN-Basic library uses the
chardevdriver, which can simplify code shared with Windows. - PEAK-specific interfaces: Existing applications may already depend on
libpcan,libpcanfd,libpcanxl, or device-specific features. - Real-time Linux extensions: PEAK documents
chardevsupport for Xenomai and RTAI builds.
Choosing chardev does not by itself make an application deterministic. End-to-end timing still depends on the kernel, scheduler, USB or PCI transport, driver queues, application architecture, and CAN bus load.
The optional installation below is for applications that need chardev and PCAN-Basic. It is not a prerequisite for the SocketCAN exercises in CAN 02.
Part 1: Installing the PCAN Linux Driver
Download the current driver package from PEAK-System's Linux page and check the version-specific PCAN Driver Manual before building it.
Step 1: Download and Extract
Extract the downloaded package:
tar -xzvf peak-linux-driver-*.tar.gz
Enter the extracted directory and remove artifacts from any previous build. The trailing slash excludes the tarball; if several versions are present, use the exact directory name:
cd peak-linux-driver-*/
make clean
Step 2: Install Dependencies
Install the compiler, matching kernel headers, and required development libraries. Package names vary by Ubuntu release; a typical starting point is:
sudo apt-get update
sudo apt-get install build-essential linux-headers-$(uname -r) libelf-dev libpopt-dev
Step 3: Compile and Install
The default non-real-time build selects chardev:
make clean
make
sudo make install
Troubleshooting compiler errors
Use a compiler version supported by the running kernel and driver release. If the default compiler is incompatible but
gcc-12is installed, select it explicitly:make clean make CC=gcc-12 sudo make install
A Note on SocketCAN vs. PCAN-Basic
In current PCAN-Linux driver releases, the default make target builds chardev, which is the required path for PCAN-Basic on Linux.
If the adapter is not supported by the running kernel and the application specifically needs SocketCAN, rebuild PEAK's driver in netdev mode:
make clean
make netdev
sudo make install
The driver cannot expose chardev and netdev simultaneously; the selected mode is fixed at build time.
Part 2: Installing the PCAN-Basic API
PCAN Driver for Linux v9 already includes libpcanbasic in its top-level build and installation. If that package installed the required library, skip this separate installation. Use the standalone PCAN-Basic package when your driver package does not include it or you need a specific compatible library release. PCAN driver manual, §3.1–3.2
Step 1: Download and Extract
Download PCAN-Basic for Linux from PEAK-System.
Extract the tarball and navigate into the pcanbasic source directory:
tar -xzvf PCAN-Basic_Linux-*.tar.gz
cd PCAN-Basic_Linux-*/libpcanbasic/pcanbasic/
Step 2: Compile and Install
Build and install the library:
make clean
make
sudo make install
Part 3: Load the Driver
Load the newly installed module without rebooting:
sudo modprobe pcan
Connect the PCAN interface and verify that the expected device nodes are present before running an application.