macOS Wrapper Library for PCAN-USB Interfaces from PEAK-System

The PCBUSB library realizes a USB-to-CAN user-space driver under macOS for PCAN-USB interfaces from PEAK-System Technik, Darmstadt. Its API is almost compatible to PEAK´s PCANBasic DLL on Windows. For the realization of multi-vendor applications UV Software provides a CAN API V3 compatible wrapper library.

Download Sources (zip) Sources (tar.gz) @GitHub

CAN API V3 Wrapper

CAN API V3 is a wrapper specification by UV Software to have a uniform CAN Interface API for various CAN interfaces from different vendors running under multiple operating systems. The PCBUSB library comes with a PCANBasic compatible API. The PCBUSB wrapper library provides a CAN API V3 compatible API for it.

The GitHub repository contains the source code for the PCBUSB wrapper library and several alternatives to build dynamic libraries for macOS, either as a C++ class library (libPeakCAN), or as a CAN API V3 wrapper library (libUVCANPCB), as well as some example programs and my beloved CAN utilities can_moni and can_test.

Note: UV Software also provides a CAN API V3 compatible Wrapper Library for PEAK´s PCANBasic DLL for Windows.


Feature PCAN USB
CAN 2.0 :heavy_check_mark: :heavy_check_mark: Classical CAN
CAN FD :x: :heavy_check_mark: Flexible Data-rate CAN
Bit-rate, CAN 2.0 :heavy_check_mark: :heavy_check_mark: high speed: up to 1 Mbps
Bit-rate, CAN FD :x: :heavy_check_mark: nominal: up to 1 Mbps
data phase: up to 8 Mbps
11-bit identifier (STD) :heavy_check_mark: :heavy_check_mark: CAN 2.0 and CAN FD
29-bit identifier (XTD) :heavy_check_mark: :heavy_check_mark: CAN 2.0 and CAN FD
Remote frames (RTR) :heavy_check_mark: :heavy_check_mark: CAN 2.0 only
Error frames (ERR) :heavy_check_mark: :heavy_check_mark: CAN 2.0 and CAN FD
Error indicator (ESI) :x: :heavy_check_mark: CAN FD only
Bit-rate switching (BRS) :x: :heavy_check_mark: CAN FD only
Listen-only mode (MON) :heavy_check_mark: :heavy_check_mark: CAN 2.0 and CAN FD
Identifier filtering :x: :x: CAN 2.0 and CAN FD
Operation modes:      
- Monitor mode enable/disable (MON) :heavy_check_mark: :heavy_check_mark: disabled by default
- Error frames enable/disable (ERR) :x: :x: not supported
- Remote frames disable/enable (NRTR) :x: :x: not supported
- Extended frames disable/enable (NXTD) :x: :x: not supported
- Shared access enable/disable (SHRD) :x: :x: not supported
- Non-ISO CAN FD enable/disable (NISO) :x: :x: not supported
- Bit-rate switching enable/disable (BRSE) :x: :heavy_check_mark: disabled by default
- CAN FD operation enable/disable (FDOE) :x: :heavy_check_mark: disabled by default
Bit-rate settings:      
- Pre-defined bit-timing indexes :heavy_check_mark: :heavy_check_mark: acc. CiA CANopen specification
- BTR register values :heavy_check_mark: :heavy_check_mark: register fields:
- freq (clock frequency in [Hz])
- brp (bit-rate prescaler)
- tseg1 (time segment 1)
- tseg2 (time segment 2)
- sjw (synchronization jump width)
- sam (number of samples)
Message reception:      
- Message queue (FIFO) :heavy_check_mark: :heavy_check_mark: up to 64K CAN messages
- Polling :heavy_check_mark: :heavy_check_mark: return immediately
- Timed out :heavy_check_mark: :heavy_check_mark: wait up to 65’534 milliseconds
- Blocking read :heavy_check_mark: :heavy_check_mark: wait infinitely
Message transmission:      
- Acknowledged write :x: :x: not supported
- Buffered write :heavy_check_mark: :heavy_check_mark: buffer size depends on the hardware
Software Development Kit:      
- PCANBasic API (:heavy_check_mark:) (:heavy_check_mark:) with the underlying PCBUSB library
- CAN API V3 :heavy_check_mark: :heavy_check_mark: C API and C++ API by UV Software
- Dynamic library :heavy_check_mark: :heavy_check_mark: libUVCANPCB.dylib, libPeakCAN.dylib
- Static library :heavy_check_mark: :heavy_check_mark: libUVCANPCB.a, libPeakCAN.a
- Source code :heavy_check_mark: :heavy_check_mark: BDS-2-Clause or GPL-3.0-or-later
- M1 chip :x: :x: not supported
- Swift wrapper :x: :x: not available
- Python wrapper :heavy_check_mark: :heavy_check_mark: Python 2.7 and 3.8
- Windows wrapper :heavy_check_mark: :heavy_check_mark: CAN API V3 Wrapper Library
- Utilities :heavy_check_mark: :heavy_check_mark: CLI utilities can_moni and can_test
- Examples :heavy_check_mark: :heavy_check_mark: C, C++, Python


Version 0.2.1 (Commit 95dcdc6 of June 8, 2021):

  • Added a check for valid identifier range in can_write
  • Added a check for valid messages flags in can_write
  • Added a check for operation capability in can_init
  • Added a check for operation mode bit FDOE when bit BRSE is set
  • Fixed a mistake with channel name displayed instead of device name
  • Fixed a bug with casting from CAN API channel to PCAN handle
  • Fixed an out-of-bound violation in companion module can_btr
  • Repaired the Python examples (they still not work with Python 2.7)
  • Switched to a dual-license: BSD-2-Clause OR GPL-3.0-or-later

Version 0.2 (Commit 0354cb4 of February 7, 2021):

  • Applied changes from CAN API V3 specification (rev. 925 to 987)
  • Added C++ class CPeakCAN derived from abstract class CCANAPI
  • Reworked the trial program (it is now based on class CPeakCAN)
  • Reorganized the entire folder structure of the repository
  • Added my beloved CAN utilities can_moni and can_test
  • Added two simple C++ examples for sending and receiving CAN frames
  • Added a Python wrapper and two Python examples
  • Added a Doxygen configuration

Version 0.1 (Commit 28c611e of March 13, 2019):

  • Initial git tag

Supported Devices

For a list of supported device see page PCBUSB library.

Known Bugs and Caveats

For a list of known bugs and caveats see tab Issues in the GitHub repo.


This work is dual-licensed under the terms of the BSD 2-Clause “Simplified” License and under the terms of the GNU General Public License v3.0 (or any later version). You can choose between one of them if you use this work in whole or in part.


Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other countries.
Windows is a registered trademark of Microsoft Corporation in the United States and/or other countries.
PCAN is a registered trademark of PEAK-System Technik GmbH, Darmstadt, Germany.
All other company, product and service names mentioned herein are trademarks, registered trademarks or service marks of their respective owners.

Hazard Note

If you connect your CAN device to a real CAN network when using this library, you might damage your application.