We use cookies on our website to provide you with the best possible service and to further improve our website. By clicking the "Accept All" button, you agree to the use of all cookies. You can limit the cookies used by clicking on "Accept selection". Further information and an option to revoke your selection can be found in our privacy policy.

Necessary:

These cookies are necessary for basic functionality. This allows you to register on our website and forum or order products with our online shop.

Statistics:

With these cookies, we collect anonymized usage data for our website. For example, we can see which content is interesting for our visitors and which resolutions are used. We use the information to optimize our website to provide you with the best possible user experience.

Necessary
Statistics

show more

CAN XL Goes Linux: Driver Software Development by SocketCAN

Explore how Linux SocketCAN evolves to support CAN XL: new frame semantics, timing and transceiver features, and the driver configuration challenges that emerge with real hardware. Includes insights from PCAN-USB XL and PCAN-Explorer 7, now enabled since Linux 6.19.


By Dr. Oliver Hartkopp

The introduction of CAN XL (CAN with eXtended frame Length) is not only a matter of physical layer challenges, CAN controllers and CAN transceivers. Already since the introduction of CAN and CAN FD (CAN with Flexible Data rate) the software environment to access CAN interfaces evolved to handle more than one CAN format. This had not only an impact on how to read and write the CAN frame data elements (identifier, length information, data content) but also on how to configure the CAN controllers’ features, like (multiple) bit rates, sample points and transmitter delay compensations.

On Linux systems, CAN communication has been shaped for many years by SocketCAN, the kernel’s unified CAN networking framework. It has already proved its flexibility during earlier transitions, from Classical CAN to CAN FD and now CAN XL, by providing a consistent programming model while accommodating new frame formats, timing parameters, and controller features. CAN XL, however, introduces a broader set of semantic and configuration changes that go beyond frame size extensions alone. These changes require careful consideration of API design, driver configuration mechanisms, and usability, especially in a multi-vendor and multi-protocol ecosystem.

This article focuses on the driver software development perspective for CAN XL under Linux. It outlines how existing SocketCAN concepts have been extended, which challenges arise when moving from proof-of-concept environments to real hardware, and why driver configuration becomes a central topic once CAN XL controllers and transceivers are no longer theoretical. 

 

CAN XL goes Linux enabled by PCAN-USB XL and PCAN-Explorer 7.

 

Extending CAN APIs and Drivers for CAN XL

CAN XL controllers and the extended CAN XL transceivers offer new features and also introduce new restrictions that have to be handled by the application programmers interface (API). New elements like the acceptance field (AF), the service data unit type (SDT) and virtual CAN network identifiers (VCID) have to be filled and also evaluated by the application software. On the other hand new configuration options for the additional XL bit rate and the CAN transceiver mode switch (TMS) for bitrates up to 20Mbit/s have to be provided by the CAN driver. Both these extensions for the application programmer and the driver configuration should be designed in a way that the users can re-use their knowledge from CAN and CAN FD setups.

 

CAN_L, CAN_H, TXD, RXD (top down) of a CAN XL-only frame with enabled TMS.


Linux CAN XL Support: From Proof of Concept to Real Hardware

The basic CAN XL support for Linux already has been introduced in Linux 6.1 in December 2022, which provided the CAN XL user programming API with all relevant data structures and virtual CAN drivers. This enabled the development of the CAN XL support for tools to read, write, generate or dump CAN XL traffic as well as some proof-of-concept implementations of CAN-in-Automation protocols like CiA 611-1, CiA 611-2 and CiA 613-3.

With the availability of “real” CAN XL hardware the question of how to design and realize the CAN XL specific driver configuration options raise in importance. On the Linux side a very first PoC setup by NXP started with a Terasic DE1-SOC FPGA board with Ubuntu 16.04 and three BOSCH XCANB IP-cores already in 2022. Based on this work two boards were upgraded to Ubuntu 22.04.4 LTS and equipped to run with the latest Linux Mainline kernel version available. Although this Linux 6.9 environment has been successfully performed in a CiA 613-3 integration test on a plug-fest in May 2024, the CAN XL controller configurations still had to be set at compile time.

 

Displayed settings of a „mixed-mode“ CAN CC/FD/XL configuration with the “ip” tool.

 

PCAN-USB XL Starter Bundle Marks the Beginning

The work on the Linux integration of the CAN XL driver configuration became a boost with the release of the all-in-one bundle for first steps with CAN XL in April 2025, which offered a brand new PCAN-USB XL interface together with the early access version of the PCAN-Explorer 7 software for Windows 11. This PCAN XL Starter Bundle not only brought a new CAN XL hardware for interoperability testing on the authors desk – furthermore it provided a user’s view on the usability and configuration for CAN XL on a different operating system.

 

PCAN-Explorer 7 sending and receiving CAN CC/FD/ XL frames.

 

 

SocketCAN: Display the same CAN traffic with candump from the can-utils.

 

Easy CAN XL Handling with Explorer 7

Especially the CAN CC/FD/XL bitrate settings with calculations for the transmitter delay compensations, the error signaling and the PWM calculations in the case of the CAN XL transceiver mode switching were very helpful to embrace the real world effects of the released ISO CAN standard. In addition to the excellently visualized CAN XL configuration restrictions by the Bitrate Manager, the PCAN-Explorer 7 itself provided the access to all kinds of CAN XL specific frame content down to the SEC and also the RRS bit, which is not made visible by default in some competitor tools.

 

The Bitrate Manager of PCAN-Explorer 7 calculates, validates, and visualizes all CAN, CAN FD, and CAN XL bit timing and transceiver parameters.

 

Doing multiple interoperability tests was very convenient and successful and also led to some early feedback to the PEAK Linux driver developers which were involved in the discussions about the Linux CAN XL configuration API too. This helped to define simple and user-friendly options that only expose required settings and derive some CAN controller specific options (e. g. the error signaling) automatically:

 

Mode Set

CAN CC

CAN FD

CAN XL

Error Signaling

TMS

Remark

FD

XL

 

 

 

 

 

 

off

off

Y

N

N

(enabled)

(off)

CC-only mode

on

off

Y

Y

N

(enabled)

(off)

CC/FD  mode

on

on

Y

Y

Y

(enabled)

(off)

mixed mode

off

on

N

N

Y

(disabled)

optional

XL-only mode

 

Now that the CAN XL driver configuration is publicly available since Linux version 6.19 it is just a matter of time that the PCAN-USB XL CAN adapter will not only be supported in the recently released PEAK Linux driver 9.0 but also show up in the Linux Mainline kernel. This would provide a full featured out-of-the-box CAN XL plug-and-play solution that works with all CAN XL enabled Linux tools including WireShark.

 

About the Author

After gaining his Diploma in Computer Science studies, Oliver Hartkopp had his first contact with the CAN bus at Bosch in 1996. Since 2001 he worked on the CAN support for Linux at Volkswagen as an internal research project which was made an Open Source project in 2006. 

SocketCAN is the official CAN (Controller Area Network) implementation in the Linux kernel. It provides a set of CAN drivers and a networking framework that enables CAN communication using the standard BSD socket API. The core idea is to treat CAN buses like network interfaces, allowing developers to use familiar networking concepts instead of proprietary or device-specific CAN APIs. SocketCAN was contributed to the Linux kernel in 2008 and is since guided by Dr. Oliver Hartkopp.