The PCBUSB library realizes a USB-to-CAN user-space driver under macOS for PCAN-USB interfaces from PEAK-System Technik, Darmstadt. It supports up to 8 PCAN-USB and PCAN-USB FD devices. The library offers an easy to use API to read received CAN messages from a 64K message queue and to transmit CAN messages. Standard CAN frames (11-bit identifier) as well as extended CAN frames (29-bit identifier) are supported. The PCAN-USB FD device can be operated in CAN 2.0 and CAN FD mode.
The dynamic library libPCBUSB is running under macOS 10.13 and later (x86_64 architecture). The API is almost compatible to PEAK´s PCANBasic DLL on Windows. See the MacCAN website for details.
Note: UV Software also provides a CAN API V3 compatible Wrapper Library for macOS.
|CAN 2.0||supported by PCAN-USB, PCAN-USB FD|
|CAN FD||supported by PCAN-USB FD only|
|Bit-rate, CAN 2.0||high speed: up to 1 Mbps|
|Bit-rate, CAN FD||nominal: up to 1 Mbps
data phase: up to 8 Mbps
|11-bit identifier (STD)||CAN 2.0 and CAN FD mode|
|29-bit identifier (XTD)||CAN 2.0 and CAN FD mode|
|Remote frames (RTR)||CAN 2.0 mode only|
|Error frames (ERR)||not realized yet|
|Error indicator (ESI)||CAN FD mode only|
|Monitor mode (MON)||listen-only mode (transmitter off)|
|Receive queue (FIFO)||up to 65’536 CAN messages|
|Blocking read||via a file descriptor and system call
|Identifier filtering||not realized yet|
|Non-ISO CAN FD mode||()||HW settings of the device cannot be changed by the library|
|Software interface (API)||compatible to PEAK´s PCANBasic API with some limitations|
|Dynamic library (
||binary for x86_64 only|
|Static library (
|Source code||not available|
|M1 Chip||not supported|
|Swift Wrapper||not available|
|CAN API V3 Wrapper||available for macOS and Windows|
|Examples||C++, Python, Objective-C (Demo App)|
- Support of PCAN-USB Pro FD devices, but only the first channel (CAN1).
- Set linker options
- Synchronized the API with Peak´s PCANBasic version 220.127.116.110
- Updated the Python example: reworked the output format.
- Data types from
<MacTypes.h>as replacement for Peak´s usage of Windows
UINT64(field CAN ID is now 32-bit wide)
- Synchronized the API to Peak´s PCANBasic version 18.104.22.1688
PCAN_DEVICE_IDcan be read in pre-initialization state
- Fixed some bugs with status bit:
- Added a delay of 1 μsec in
CAN_Writeto run on macOS 10.15 (Catalina)
- Adapted trace-file headers to Peak’s changes in version 22.214.171.124
- Support of PCAN-USB FD devices in CAN 2.0 mode (CAN classic) and CAN FD mode!
- Adapted the API according to Peak’s changes in version 126.96.36.199 and harmonized return codes with it.
- Fixed issue #208 ‘CAN_Write stuck when errors on the bus are present’.
- Conducted an intermediate solution for issue #246 (writing into a trace file).
- Added run-path-relative install name to the library (using the
- Adapted the API according to Peak’s changes in version 188.8.131.52 and harmonized return codes with it.
- Implemented parameter
PCAN_RECEIVE_EVENTreturns a file descriptor to realize ‘blocking read’ by
select()` as on the Linux implementation of the PCAN-Basic API.
- Added two C++ examples and one Python example using the PCBUSB library
- Feature ‘Reading/Writing of parameter
- Fixed issue #104 ‘Hot plugging was not detected by the library/driver’.
- Fixed issue #117 ‘Permission for libPCBUSB.x.y.lib wrong’ (chmod 755).
- Return codes of API functions harmonized with PCANBasic.dll (184.108.40.206).
- Time-stamps are now taken from CAN controller instead of taking them from the system clock.
- Getting and setting of
PCAN_*parameters reworked (to be almost compatible to the PCANBasic DLL, version 1.3).
- Resetting of RCV queue and XMT queue on the CAN controller realized.
- Fixed issue #11 ‘All channel initialized by the application will be closed even if they are in use’.
CAN_Unitialize: closing all channel initialized by the application at once implemented.
CAN_Read: receive queue overrun handling reworked.
CAN_*: wrong function return codes corrected.
CAN_GetErrorText: language support for English, German, French, Italian and Spanish added.
- Minor changes
- Initial revision
Only the following devices from PEAK-System Technik are supported:
- PCAN-USB (product code: IPEH-002021, IPEH-002022)
Since version 0.8 (Build 689 of September 20, 2017):
- PCAN-USB FD (product code: IPEH-004022)
For technical specifications, prices and delivery terms see PEAK´s website.
Known Bugs and Caveats
For a list of known bugs and caveats see the
README file delivered with each release.
The PCBUSB library is freeware without any warranty or support!
Please note the copyright and license agreement.
Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other countries.
PCAN is a registered trademark of PEAK-System Technik GmbH, Darmstadt, Germany.
Qt is a registered trademark of The Qt Company Ltd. and its subsidiaries.
All other company, product and service names mentioned herein are trademarks, registered trademarks or service marks of their respective owners.
If you connect your CAN device to a real CAN network when using this library, you might damage your application.