Overview | Quick Start | Samples | Architecture | CoSlave | CoMaster | Listeners | Object Dictionary | Configuration | Eds2Od
CANoopEn is a CANopen protocol stack written in clean, object-oriented C++17 — designed for portability, testability and readability. The stack is completely target-independent and runs on any hardware architecture; ready-to-build samples are currently available for STM32 (bare-metal and FreeRTOS), with more platforms to follow. CANoopEn is developed and maintained by Xyntos GmbH.
The complete project is available on GitHub under the Apache License 2.0:
| Repository | Content |
|---|---|
| CANoopEn | The stack — clone it or add it as a git submodule to your project |
| CANoopEnDemo | Ready-to-build sample projects (bare-metal and FreeRTOS, CiA 401 and CiA 417) |
| CANoopEnTest | The unit test suite, running on every commit |
| CANoopEnTools | Eds2Od, the object dictionary generator — download |
CoSlave or CoMaster; the object dictionary is a class with typed entry objects; callbacks are virtual methods on listener interfaces.SendCanMessage) and receives messages and time through two Proceed calls. Porting means implementing three small interfaces.CoSettings. Object dictionary entries are plain member objects owned by your application.void*, no casts (details).CoConfiguration feature switches (-DCO_ENABLE_LSS=0, …) to fit small flash budgets.| Area | Support |
|---|---|
| NMT (CiA 301) | Slave and master state machines, boot-up, start/stop/reset commands |
| Heartbeat | Producer and consumer with timeout monitoring (objects 1016h/1017h) |
| SDO server | Expedited, segmented and block transfer, multiple channels |
| SDO client | Synchronous read/write of remote object dictionaries, block transfer |
| PDO | Transmit and receive PDOs with mapping parameters, event-driven transmission |
| MPDO | Multiplexed PDOs, source (SAM) and destination (DAM) addressing mode |
| SYNC / TIME / EMCY | Producer and consumer, error history (object 1003h) |
| LSS (CiA 305) | Master and slave role: node-id and bit timing configuration, identity inquiry |
| Indicators (CiA 303-3) | Run/error LED flash patterns computed by the stack |
| NMT master boot-up (CiA 302-2) | Demonstrated in the master samples (“boot NMT slave” process) |
| CiA 417 (lift application profile) | Profile COB-ID mapping and virtual I/O mapping helpers |
class MyDevice : public CANoopEn::CoSlave,
public CANoopEn::ICoListener,
public CANoopEn::ICoObjectDictionaryListener,
public CANoopEn::ICoSendHandlerListener
{
public:
MyDevice() : CoSlave(*this, _objectDictionary, *this, NodeId, _cobId),
_objectDictionary(*this) {}
// Your CAN driver, called by the stack for every outgoing frame
bool SendCanMessage(const CANoopEn::CoCanMessage& msg) override;
// Callbacks you care about (NMT state, EMCY, LEDs, OD writes, ...)
void OnNmtStateChange(uint16_t nodeId, CANoopEn::CoNmtState state) override;
// ...
private:
static constexpr uint16_t NodeId = 10;
MyDeviceOd _objectDictionary; // derives CoObjectDictionary
CANoopEn::CoCobIdCia301 _cobId; // standard CiA 301 COB-IDs
};
// main loop: feed received frames and call the scheduler periodically
for (;;)
{
if (canDriver.ReceiveCanMessage(msg))
device.Proceed(msg);
if (cycleTimerElapsed) // every CoSettings::CoCycleTime ms
device.Proceed();
}
The fastest way to a running CANopen node is the Quick Start Guide — from git clone to a live node on the CAN bus in about half an hour, using the low-cost ST NUCLEO-C092RC board and VS Code.
Ready-to-build sample projects (bare-metal and FreeRTOS) live in the repository CANoopEnDemo — the Samples page describes them in detail.
ICoListener, ICoSendHandlerListener, ICoObjectDictionaryListenerCoObjectDictionary, entry types, PDO mapping, EDS generation with Eds2OdCoSettings, CoConfiguration, CiA 301/417 COB-IDs, system layerCANoopEn is licensed under the Apache License, Version 2.0.
CANoopEn is developed by Xyntos GmbH, a Swiss engineering company specializing in embedded software. If you need support integrating CANopen into your product — from device firmware to conformance — get in touch.
