embedded-office / canopen-stack

Free CANopen Stack for Embedded Systems
https://canopen-stack.org
Apache License 2.0
382 stars 115 forks source link
canopen embedded mikrocontroller

Free CANopen Stack

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.

Features

General

CiA 301 - CANopen application layer and communication profile

CiA 305 - Layer Setting Services (LSS)

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)

Usage

With version 4.4, the CANopen Stack project introduces an ecosystem that tries to support you in your project management. This support uses multiple repositories for essential aspects of an embedded software project setup:

Add Component in CMake (recommended)

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}
)

History

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

License

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.

Code of Conduct

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.

Contribution

Issues and Questions

Feel free to write bug reports, questions or and feedback as issue within this github repository.

Development Environment

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.

Development Tools

Download and install these free tools for your system:

Note: on my Windows machine, I use the Visual Studio 2019 Build Tools which inlcudes the LLVM compiler and the required Windows SDK libraries.

Run the Test Applications

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