[CAN 05] - PCAN Device Driver Installation on Linux

Step-by-step guide to installing PEAK-System's PCAN drivers on Linux for SocketCAN and PCAN-Basic API

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 as can0.
  • 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 chardev driver, 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 chardev support 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.

This guide compiles the PEAK-System driver in its default chardev mode and then installs PCAN-Basic.

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:

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-12 is 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

With the driver installed in chardev mode, install the PCAN-Basic library for applications that use PEAK’s cross-platform API.

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.

References