CANopen free Software Resource Center


CANopen SlaveLib

Developers wanted!

This is a preview version of the CANopen SlaveLib. It is yet useful for very simple CANopen devices, but should become a complete standard compliant CANopen library for slave devices. To get to this point, we need more developers and testers! This is the right time for developers to download this project and participate the development process. If you're interested in developing this library, contact me: and send me your sourceforge username (if available) so i can add you to the developers list.

CANopen SlaveLib is an opensource CANopen implementation for slave Devices. Its license is LGPL.

The aim of this software

  • Opensource and therefore available for everyone
  • Standard-compliant
  • Highly portable
  • Programmed in ANSI-C (especially because of the portability)
  • ... lets find some other goals (such as memory-optimized and

Project state
This library should be called developer release because not all features of canopen are implemented at the moment. The features that are implemented should be stable (at least there are no known problmes).

Implemented features an their limitations:

  • The object dictionary (including accessing it) is created. It supports communication parameters, such as manufacturer information, serial number of the device, revision number, ... It also supports error register entries (although they are not used by the library), and so on. Heartbeat settings (Heartbeat consumer/producer) can be placed into the object dictionary. The heartbeat settings are used by the CANopen SlaveLib. Server/Client SDO Parameter can be setted up too. This settings are not used by the library at the moment. PDO communication and mapping Parameter can also be setted up. They are used by the library (there are some limitations: e.g. only transmission type 255 is supported yet). Digital I/O-Profile (DS-401) are implemented (I don't know exactly this standard, so at the moment there's only digital I/O implemented (with support of 8Bit variables).
  • PDO transfer should work quite well. The CANopen SlaveLib should recognize incoming PDO-Messages, analyse them, check wheter the node is a consumer of the arrived PDO and if this is the case, it sets the local variable to the new value. Also sending of PDOs should work well. If a process variable (a local one) changes, the correct function has to be called manually. This function sends the changed (even if there are more than one defined variable, only the changed ones are sent: transmission type 255) values via PDO-Message. Limitation: all this features only works for transmission type 255 yet. Remotely requested PDO transfer does also not work.
  • Heartbeat is working: Heartbeat-messages are sent in predefined times (the defined time is read from the object dictionary). Incoming heartbeats are analysed and, if a heartbeat hasn't arrived within the predefined time (this time is also configured in the object dictionary) a function is called, where the user can handle this event/error.
  • With the CANopen SlaveLib you can start and stop remote CANopen devices. There should be no limitations
  • The CANopen SlaveLib comes with a state machine, which works in the manner CANopen demands a state machine: After power up of the device, the statemachine automatically starts with the initialisation phase. After initialisation it automatically changes into pre-operation state. It remains there until a start-remote-node message arrives (normally sent by the master). then it changes into the operation state. The device can then be stopped or reseted. Limitations: Not all functions are allowed in all states (e.g. sending/receiving of PDO shouldn't be possible in pre-operational state). This restriction is not yet implemented, but should be done within one or two hours.
  • NMT-services are implemented. This lib contains a state machine (initialisation of commnication and node, pre-operational, operational, stopped). This states can be changed by receiving NMT messages from a NMT master.

Not yet implemented features (to do list):
  • SDO Transfer should be implemented, so other nodes can access the object directory of devices programmed with this CANopen SlaveLib. This shouln't be very tricky, since this functionality can more or less be copied from the CanFestival project (
  • Sync objects should be implemented, so the SlaveLib can send Syncs and also receives/analyses sync-objects.
  • Emergency-messages should be implemented, so it is possible for devices to send internal errorstates. Implementing this feature shouln't take too much time.
  • Implement PDO transfer for the other transmission types (as described above: only transmission type 255 is implemented at the moment)
  • PDO transfer for remotely requested PDOs should be implemented.
  • More profiles should be implemented. Also a new design for easily using/implementing different profiles should be created. It should be very easy (for the user of this library) to choose one or more profiles without knowing too much about CANopen.
  • A memory optimized and a speed optimized version should be created. This two versions should ideally consists in the same sourcecode (maybe by preprocessor-directives the user can tell the compiler which version he wants to use). I assume that for example a Linux-CANopen slave must be speedoptimized, where a personal computer comes with more than enough memory. On the other side, microchip based CANopen slave has to be memory optimised, because of its memory limitations.
  • A (very) future step should be to create a GUI application which helps the user to use this CANopen SlaveLib. I imagine a GUI in which the user can manipulate all constants graphically (e.g. how many receive/transmit PDO, how many heartbeats he listens, ...) and also put his ''user-code'' (the application that runs on the microchip) in, so the GUI automatically puts this ''user-code'' into the correct section (function) of the app.c file. In short: in future, it should be possible to create CANopen devices, without knowing much about CANopen.
  • Together with the GUI we should create a program which automatically creates (standard conform) EDS files.
  • Porting the library to a wide range of platforms/compilers.

Documentation The documentation for this library has been written in LaTeX and can be downloaded as PDF and as sourcecode form this homepage. The documentation has been splitted into two pieces: a developer manual and a user manual. Additionally you can find the API-documentation (generated with doxygen) on this homepage, or you can download it for offline browsing. The text on this homepage is (more or less) copied out of this two documents. For more detailed information read this two documents.
Download this documents here:

Developing We are searching for developers! If you are able and willing to implmement some of the missing features or wanna test this library and find/correct bugs, please feel free to do! for any questions contact:

Downloads As described, CANopen SlaveLib is available for two different platforms. Therefore, you can download two different versions of the CANopen SlaveLib: one for Linux and one for Microchip's PIC microcontroller. Download them here:

Installation Please download the PDF documentation files for information about installation and usage.

Special thanks goes to:

  • Edouard Tisserant (developer of CANFestival) who helped me creating the object dictionary. Also some pieces of code has been taken from his project (which is now LPGL too)
  • Roland Rütimann who helped me solve problems while programming the PIC microcontroller.
  • HSR (Hochschule Rapperswil where this project was born.

Copyright 2001-2002 CANopen free software resource center
Unless otherwise noted, all material is licensed under the GPL License

SourceForge Logo