This project is a free implementation of the CANopen protocol according to the free specification CiA 301. You need to register at Can in Automation (CiA) to retrieve your copy of the specification.
The source code is compliant to the C99 standard and you must cross-compile the source files as part of your project with the cross-compiler of your choice.
Note: The source code of this project is independent from the CAN controller and microcontroller hardware. The hardware specific parts are called drivers. For a full featured CANopen stack, we need the drivers for hardware timer, CAN controller and a non-volatile storage media.
General
- Usable with or without a real-time operating system (RTOS)
- Software timer management
CiA 301 - CANopen application layer and communication profile
- Unlimited number of SDO servers which supports:
- Expedited transfers
- Segmented transfers
- Block transfers
- Unlimited number of SDO clients which supports:
- Expedited transfers
- Segmented transfers
- Unlimited number of TPDO and RPDOs which supports:
- Synchronized operation
- Asynchronous operation
- Manufacturer specific operation
- Unlimited number of entries in object dictionary
- Static or dynamic object dictionary
- Data types: signed/unsigned 8/16/32-Bit integer, string, domain and user-types
- Unlimited number of parameter groups for parameter storage
- Emergency producer which supports:
- Manufacturer specific extensions
- Unlimited error history
- Unlimited Emergency consumers
- SYNC producer
- Unlimited number of SYNC consumers
- Heartbeat producer
- Unlimited number of Heartbeat consumers
- Network Management consumer
CiA 305 - Layer Setting Services (LSS)
- Baudrate configuration
- NodeId configuration
Note: the term 'unlimited' means, that the implementation introduces no additional limit. There are technical limits, described in the specification (for example: up to 511 possible TPDOs)
With version 4.4, the CANopen Stack project introduces an ecosystem which supports you in managing target specific applications. This support uses multiple repositories for different aspects of the embedded software project setup:
- cmake-scripts - this repository is responsible for the embedded toolchains and the component package management.
- canopen-stack - this repository represents the platform independent CANopen stack component.
- canopen-stm32f7xx - this repository contains a complete Quickstart example setup for the device
STM32F769
. - STM32CubeF7 - this fork of the ST Microelectronics HAL package is integrated into the CMake build system and packaged with minimal required source files to get the ST HAL/LL drivers working (No middleware and documentation).
- canopen-stm32f4xx - this repository contains a complete Quickstart example setup for the device
STM32F446
. - STM32CubeF4 - this fork of the ST Microelectronics HAL package is integrated into the CMake build system and packaged with minimal required source files to get the ST HAL/LL drivers working (No middleware and documentation).
The build system is realized with CMake and the CPM.cmake package management. See cmake-scripts for details. Adding the CANopen Stack into your project is done during the configuration phase of the build environment. During this phase, the CANopen Stack is fetched in the defined version and is available for usage.
set(CO_TARGET "canopen-stack")
set(CO_PROJECT "embedded-office/canopen-stack")
set(CO_VERSION "4.4.0")
CPMAddPackage(
NAME ${CO_TARGET}
URL https://github.com/${CO_PROJECT}/releases/download/v${CO_VERSION}/${CO_TARGET}-src.zip
VERSION ${CO_VERSION}
)
The first release of this CANopen stack is back in 2005. It is still used in many CANopen nodes from small startup companies up to big players in the automation market. Since Embedded Office sells an OEM license to Micrium to provide the CANopen stack as a part of the uC/ product line, we maintain the CANopen stack for the Flexible Safety RTOS and bare metal usage in parallel.
Some years later, now in 2020, we think it is time for a new way of software development of components where no product specific know-how is neccessary. This project is the try with the hope, that this way of software development is good for existing customers, for Embedded Offic and for all potential new users.
To avoid confusion, it is the best to continue with the release version numbering. The first stable release of the open-source variant of the CANopen Stack is: V4.0.0
The Apache 2.0 license is suitable for commercial usage, so we think this is the best for this free component. If you have problems or concerns with this license, just contact us at Embedded Ofice. We will help you to get the legal approvals within your company.
As everywhere in the world (especially in the internet) and at every time, we think a respectful and open minded communication is essential for peaceful and innovative developments. Please have a look in our Code of Conduct and think about your writing before submitting.
Feel free to write bug reports, questions or and feedback as issue within this github repository.
The development environment for the CANopen stack takes place on the host machine. In release 4.4.0, we have decided to switch from the Windows-only MSVC compiler to the LLVM compiler. The main reason for this decision is that the same compiler is available for Windows, Linux, and Mac OS users.
Download and install these free tools for your system:
- Install the build tools Cmake
- Install the build system Ninja
- Install the static checker cppcheck
- Install the compiler LLVM
Note: on my Windows machine, I use the Visual Studio 2019 Build Tools which inlcudes the LLVM compiler and the required Windows SDK libraries.
The application is build with CMake using the provided presets:
# configure the project build environment for your host system
$ cmake --preset llvm-host
# build the library for your host and all test applications
$ cmake --build --preset debug
# execute all test applications
$ ctest --preset all