Attention

You are viewing an older version of the documentation. The latest version is v3.3.

CANopen Overview

CANopen is a CAN-based communication system, which comprises higher-layer protocols and profile specifications. CANopen has been developed as an international standard (EN 50325-4)(CiA301) with highly flexible configuration capabilities. It is used in various applications, such as medical equipment, AMR, and Robotic or motion-oriented machine control systems.

A general CANopen device has three logical parts:

  • CANopen protocol stack handles communication via the CAN network.

  • Application software provides the internal control functionality and the interface to process hardware.

  • Object dictionary interfaces the protocol and the application software. It contains references of all data types used, and stores all communication and application parameters.

This section describes how to run CANopen stack on Intel® Edge Controls for Industrial (ECI).

Preparation

The following section is applicable to:

../_images/target2.png

Loading the Driver

For PEAK-miniPCIe Card

Check the CAN driver status, and confirm whether the peak_pci kernel driver is in use:

01:00.0 Network controller: PEAK-System Technik GmbH Device 0008 (rev 02)
        Subsystem: PEAK-System Technik GmbH Device 0002
        Flags: bus master, fast devsel, latency 0, IRQ 16
        Memory at 90810000 (32-bit, non-prefetchable) [size=64K]
        Memory at 90800000 (32-bit, non-prefetchable) [size=64K]
        Capabilities: <access denied>
        Kernel driver in use: peak_pci
        Kernel modules: peak_pci

If the peak_pci kernel driver is not in use, set up udev rules or type the following manually:

modprobe peak_pci

For virual CAN

Load the kernel module for virtual CAN support:

modprobe vcan

Setting up CAN/VCAN Interface

For PEAK-miniPCIe Card

  • Configure CAN bitrate (for example, 1Mbps):

    ip link set can0 type can bitrate 1000000
    

– Bring up the CAN interface:

ip link set up can0

– Check the CAN interface link status:

ip addr ls dev can0

For virual CAN

  • Add a virtual interface:

    ip link add dev vcan0 type vcan
    

– Bring up the virtual CAN interface:

ip link set up vcan0

– Check the CAN interface link status:

ip addr ls dev vcan0

CANopen - Sanity Check

The following section is applicable to:

../_images/target2.png

Sanity-Check #2: SocketCAN dump test

Step 1: Set up virtual CAN

Step 2: Capture the incoming CAN frames on vcan0

candump vcan0

Step 3: Send a standard CAN frame with 0x1FF as the ID and 0x01, 0x02, 0x03, 0x04 as 4-byte payloads:

cansend vcan0 1FF#01020304

Sanity-Check #3: CANopen tests automatically

Step 1: Set up virtual CAN.

Step 2: Go to the /opt/canopen/test/running_canopen directory.

Step 3: Run tests automatically:

./test_canopend.sh

Step 4: View the test results in console as below:

29 tests, 0 failures

Test duration: 5.450681987 sec

./canopend[7269]: CANopen device, Node ID = 0x7F, finished
./canopend[7263]: CANopen device, Node ID = 0x01, finished./canopend[7265]: CANopen device, Node ID = 0x04, finished./canopend[7267]: CANopen device, Node ID = 0x63, finished


press enter to continue...