Skip to content

Latest commit

 

History

History
125 lines (85 loc) · 6.44 KB

README.md

File metadata and controls

125 lines (85 loc) · 6.44 KB

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

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

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:

  • 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. The adaption to other devices out of the STM32F7 series are small.
  • 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).

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:

  • 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.

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