Xyntos | Logo

Overview  |  Quick Start  |  Samples  |  Architecture  |  CoSlave  |  CoMaster  |  Listeners  |  Object Dictionary  |  Configuration  |  Eds2Od


CANoopEn Quick Start Guide

This guide takes you from nothing to a running CANopen node on real hardware — a CANopen slave built with CANoopEn, flashed onto an ST NUCLEO-C092RC board, talking on a live CAN bus. Plan roughly half an hour, most of it download time.

1. What you need

Hardware

Item Notes
ST NUCLEO-C092RC Low-cost evaluation board (STM32C092RC, Arm Cortex-M0+) with on-board ST-LINK debugger and on-board CAN FD transceiver — no shield or external debugger needed.
A second CAN node Ideal: a second NUCLEO-C092RC (one runs the slave sample, one the master sample), or any USB-CAN adapter (e.g. PEAK PCAN-USB, candleLight) so you can watch and inject frames from your PC.
USB-C cable, two wires CAN_H and CAN_L between the boards. Keep the stub short; terminate the bus with 120 Ω if your adapter is unterminated.

The samples run the bus at 250 kbit/s.

Software

Tool Notes
Git To clone the repositories.
Visual Studio Code The samples are CMSIS solution projects for VS Code.
Arm Keil Studio Pack (VS Code extension pack) Install from the VS Code marketplace. It brings the Arm CMSIS Solution extension (build/run/debug) and the Arm Tools Environment Manager, which automatically downloads the compiler, CMake, Ninja and the CMSIS-Toolbox declared in each sample’s vcpkg-configuration.json — you don’t install a toolchain by hand.

Everything works the same on Windows, Linux and macOS.

2. Clone the sample project

The samples live in the canoopendemo repository; the CANoopEn stack itself is included as a git submodule, so clone recursively:

git clone --recurse-submodules https://github.com/xyntos-ch/canoopendemo.git

(If you already cloned without submodules: git submodule update --init.)

You get:

canoopendemo/
├── CANoopEn/                  # the stack (submodule)
└── Samples/
    ├── CanOpenClient/         # slave samples
    │   ├── CiA401/{BareMetal, FreeRTOS}
    │   └── CiA417/{BareMetal, FreeRTOS}
    └── CanOpenMaster/         # master samples
        └── CiA401/FreeRTOS

3. Build the slave sample

  1. In VS Code, open the workspace file Samples/CanOpenClient/CiA401/BareMetal/VSCode/VSCode.code-workspace.
  2. The Arm Tools Environment Manager reads vcpkg-configuration.json and activates the required tools (first time: a few minutes of downloads; accept the prompt to activate the environment).
  3. Open the CMSIS view in the sidebar and click Build. The first build also downloads the required CMSIS packs (CMSIS 6, STM32C0 device family pack).

The build produces CanOpenClient.elf for the STM32C0 target (Debug and Release).

Prefer the command line? With the CMSIS-Toolbox on your PATH:

cbuild CanOpenClient.csolution.yml --update-rte --packs

4. Flash and run

  1. Connect the NUCLEO board via USB (the ST-LINK side).
  2. In the CMSIS view click Run (or press F5 for Debuglaunch.json is preconfigured for the on-board ST-LINK).

The board now runs a CANopen slave with node-id 10. After boot-up the node is in pre-operational state; per CiA 303-3 the green run LED blinks.

5. First steps on the CAN bus

Wire CAN_H/CAN_L to your second node or USB-CAN adapter (250 kbit/s) and watch the traffic. All examples below use can-utils notation (cansend/candump on Linux); with PCAN-View or similar tools enter the same IDs and data bytes.

Right after reset you see the boot-up message and then a heartbeat every 1000 ms reporting pre-operational state:

70A  [1]  00        # boot-up
70A  [1]  7F        # heartbeat: pre-operational

Start the node (NMT start, command 01, node 0A):

cansend can0 000#010A

The heartbeat switches to 05 (operational) and the green run LED goes solid. Now process data is live:

  • Press the blue user button — the slave publishes TPDO 1 with the digital input block (object 6000h, bit 0 = button):

    18A  [1]  01      # button pressed
    18A  [1]  00      # button released
  • Write the digital outputs (object 6200h) by sending RPDO 1:

    cansend can0 20A#01
  • Read and write an object via SDO — e.g. the demo object 2000h (UNSIGNED8, read/write):

    cansend can0 60A#40.00.20.00.00.00.00.00     # SDO upload request
    58A  [8]  4F 00 20 00 00 00 00 00            # response: value 0x00

The sample also prints a debug trace of everything it does (NMT state changes, SDO aborts, OD writes) on the ST-LINK virtual COM port at 115200 baud.

6. Where to go next

Sample What it shows
CanOpenClient/CiA401/FreeRTOS The same slave running under FreeRTOS: CAN reception and stack scheduling in separate tasks.
CanOpenMaster/CiA401/FreeRTOS A CANopen master that boots, configures and monitors the slave following the CiA 302-2 “boot NMT slave” process — flash it onto the second NUCLEO board.
CanOpenClient/CiA417/{BareMetal, FreeRTOS} A CiA 417 lift application profile node (call panel) using the profile COB-ID mapping and virtual I/O mapping.

To understand what you just ran — and to build your own device — continue with the Architecture overview and the API reference: CoSlave · CoMaster · Listeners · Object dictionary · Configuration & porting

XYNTOS_Logo_mit_claim_weiss