CANopen Master Documentation
Version 6.08.00
Loading...
Searching...
No Matches
CANopen Master Library

The source files of the CANopen Master Protocol Stack can be used to build a shared library for Linux, macOS and Windows. The shared library provides a C code API which is defined in the header file canopen_master.h, located in the directory source/include.

A CMake project file for building the CANopen Master library is hosted in the directory source/application/library.

How to build

Create a local build directory and start the build process within this directory. Make sure to pass the correct toolchain (i.e. GNU Arm Embedded Toolchain) to the CMake process via the parameter -DCMAKE_TOOLCHAIN_FILE.

Default configuration

The supported services of the CANopen Master library are configured inside the CMakeLists.txt file. The default configuration is:

  • 4 CAN interfaces (i.e. logical networks)
  • 127 nodes (for each network)
  • 2 SDO clients (for each network)
  • 512 RPDO and 512 TPDO (for each network)

CANpie driver selection

The library can be built using either the Linux socketcan driver or the CANpie Server driver. The driver is selected by the configuration symbol CANPIE_DRIVER. Possible values are:

Symbol CANPIE_DRIVER Selected driver
socketcan Linux socketcan driver
cpserver CANpie Server

Please note that the usage of the CANpie Server driver requires an installation of Qt.

CANpie FD driver - Linux socketcan

The Linux socketcan driver requires that the target is build on a Linux system.

mkdir build
cd build
cmake -DCANPIE_DRIVER=socketcan ..
cmake --build .

CANpie FD driver - CANpie Server

This driver is taken as default if the driver name in omitted.

mkdir build
cd build
cmake ..
cmake --build .

Compilation under Windows

mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 ..
cmake --build .

Event handler selection

Events generated by the CANopen Master protocol stack can be signalled in different ways. The event dispatcher is selected by the configuration symbol COM_EVENT_DISPATCHER. Possible values are:

Symbol COM_EVENT_DISPATCHER Selected dispatcher
csharp Dispatcher for C# binding
mco Dispatcher for MCo class library, MCoEvent
qco Dispatcher for QCo class library, QCoEvent

If no event dispatcher is defined during configuration the qco is taken as default.

How to install

You must have root rights for installation. The files are copied to the following locations:

File Path
canopen_master.h /usr/local/include
libcanopen.* /usr/local/lib
sudo make install