CANopen (CiA 402)

Last updated 2026-11-27

The drive is a CANopen device with the CiA 402 drive profile. This page covers the CAN IDs, network management, reading and writing objects, the CiA 402 state machine, modes of operation, the standard objects, cyclic control with PDOs and SYNC, and emergency messages. The content follows CiA 301 and CiA 402. Drive-specific values are TBD.

Status

Item Value
Device description file Not released. Format (EDS, CiA 306, or XDD, CiA 311): TBD.
Factory node ID TBD
Supported modes of operation TBD. Read 0x6502 on the drive.
Implemented objects TBD. The device description file will list them.
Default PDO mapping TBD
Position and velocity units TBD
Rated torque (0x6076) TBD
CANopen variant on a CAN FD bus TBD. Classic CANopen (CiA 301) uses classic CAN frames. CANopen FD (CiA 1301) uses CAN FD frames and replaces SDO with USDO. The examples on this page use classic CANopen.

CAN IDs

CANopen derives most CAN IDs from the node ID (1 to 127). These are the defaults of the CiA 301 predefined connection set.

Object CAN ID Sent by
NMT command 0x000 Host
SYNC 0x080 Host
EMCY (emergency) 0x080 + node ID Drive
TPDO1 to TPDO4 0x180, 0x280, 0x380, 0x480 + node ID Drive
RPDO1 to RPDO4 0x200, 0x300, 0x400, 0x500 + node ID Host
SDO response 0x580 + node ID Drive
SDO request 0x600 + node ID Host
Heartbeat and boot-up 0x700 + node ID Drive

The CAN IDs for UDS are on the UDS diagnostics page.

Network management (NMT)

An NMT command is a two-byte frame on CAN ID 0x000: the command, then the node ID. Node ID 0 addresses every node.

Command Byte 0 Example: all nodes
Start (go to operational) 0x01 cansend can0 000#0100
Stop 0x02 cansend can0 000#0200
Enter pre-operational 0x80 cansend can0 000#8000
Reset node 0x81 cansend can0 000#8100
Reset communication 0x82 cansend can0 000#8200

To address one node, put its node ID in byte 1. For node 0x0A: cansend can0 000#010A.

SDOs work in pre-operational and operational. PDOs work only in operational.

The heartbeat frame (0x700 + node ID) carries the NMT state in its one data byte:

Byte State
0x00 Boot-up (sent once at start)
0x04 Stopped
0x05 Operational
0x7F Pre-operational

The heartbeat period is object 0x1017, in ms; 0 switches the heartbeat off. The factory value is TBD.

Read and write objects (SDO)

SDO transfers read (upload) and write (download) one object at a time. Each request gets a response. Use SDOs for set-up, not for control loops.

With python-canopen and the device description file, address objects directly:

node = network.add_node(node_id, "<device-description-file>.eds")
statusword = node.sdo[0x6041].raw
node.sdo[0x6040].raw = 0x0006

Without the file, transfer raw bytes as in Getting started: node.sdo.upload(0x6041, 0) and node.sdo.download(0x6040, 0, data).

Raw SDO frames

You can also send SDO requests with cansend. Read the statusword (0x6041, sub-index 0) from node NN:

cansend can0 6NN#4041600000000000

The drive answers on 0x580 + node ID:

can0  5NN   [8]  4B 41 60 00 40 02 00 00

Byte 0 = 0x4B means two data bytes follow the index. Bytes 1–2 are the index (little-endian), byte 3 the sub-index, bytes 4–5 the value: 0x0240 in this example.

Write 0x0006 to the controlword (0x6040):

cansend can0 6NN#2B40600006000000

The drive answers 60 40 60 00 00 00 00 00 when it accepts the write.

Byte 0 Meaning
0x40 Upload request (read)
0x4F, 0x4B, 0x47, 0x43 Upload response with 1, 2, 3, 4 data bytes
0x2F, 0x2B, 0x27, 0x23 Download request (write) with 1, 2, 3, 4 data bytes
0x60 Download response: write accepted
0x80 Abort. Bytes 4–7 hold the abort code (little-endian).

Troubleshooting lists common abort codes.

CiA 402 state machine

The drive accepts motion commands only in the state Operation enabled. You move between states by writing the controlword (0x6040) and you read the state from the statusword (0x6041).

  power on
     │
     ▼
  Not ready to switch on
     │  automatic
     ▼
  Switch on disabled  ◄──────────────  Fault
     │  Shutdown 0x0006                 ▲   Fault reset 0x0080
     ▼                                  │   leads back to Switch on disabled
  Ready to switch on                    │
     │  Switch on 0x0007            Fault reaction active
     ▼                                  ▲
  Switched on                           │  any fault, from any state
     │  Enable operation 0x000F
     ▼
  Operation enabled  ── Quick stop 0x0002 ──►  Quick stop active

In CiA 402 the drive function, and so torque, is enabled only in Operation enabled and, while a quick stop runs, in Quick stop active. On a fault the drive switches torque off and the joint moves freely. The drive's quick stop behaviour (0x605A) is TBD.

Read the state

Mask the statusword and compare:

State Mask Value
Not ready to switch on 0x004F 0x0000
Switch on disabled 0x004F 0x0040
Ready to switch on 0x006F 0x0021
Switched on 0x006F 0x0023
Operation enabled 0x006F 0x0027
Quick stop active 0x006F 0x0007
Fault reaction active 0x004F 0x000F
Fault 0x004F 0x0008

Statusword bits:

Bit Name
0 Ready to switch on
1 Switched on
2 Operation enabled
3 Fault
4 Voltage enabled
5 Quick stop (0 = quick stop active)
6 Switch on disabled
7 Warning
8 Manufacturer-specific: TBD
9 Remote
10 Target reached
11 Internal limit active
12–13 Mode-specific
14–15 Manufacturer-specific: TBD

Change the state

Command Controlword From To CiA 402 transition
Shutdown 0x0006 Switch on disabled, Switched on, Operation enabled Ready to switch on 2, 6, 8
Switch on 0x0007 Ready to switch on Switched on 3
Disable operation 0x0007 Operation enabled Switched on 5
Enable operation 0x000F Switched on Operation enabled 4
Disable voltage 0x0000 Ready to switch on, Switched on, Operation enabled, Quick stop active Switch on disabled 7, 10, 9, 12
Quick stop 0x0002 Operation enabled Quick stop active 11
Fault reset 0x0080 (rising edge of bit 7) Fault Switch on disabled 15

Controlword bits 0–3 are Switch on, Enable voltage, Quick stop (active low) and Enable operation. Bit 7 is Fault reset, bit 8 is Halt. The drive's response to Halt is TBD.

To clear a fault: remove the cause, write 0x0080, then continue with Shutdown (0x0006), which clears bit 7 again.

Modes of operation

Write the mode to 0x6060. Read 0x6061 to confirm that the drive has switched; the change is not immediate. Bit n of 0x6502 shows whether the drive supports a mode.

0x6060 value Mode 0x6502 bit
1 Profile position 0
3 Profile velocity 2
4 Profile torque 3
6 Homing 5
7 Interpolated position 6
8 Cyclic synchronous position 7
9 Cyclic synchronous velocity 8
10 Cyclic synchronous torque 9

Which modes the drive supports is TBD.

Standard objects

These are the CiA 301 and CiA 402 objects used on these pages. Which of them the drive implements is TBD.

Index Name Type Unit or content
0x1000 Device type UNSIGNED32 Lower 16 bits = 0x0192 (402)
0x1001 Error register UNSIGNED8 0 = no error
0x1003 Pre-defined error field ARRAY of UNSIGNED32 Error history
0x1010 Store parameters UNSIGNED32 Write 0x65766173 ("save")
0x1011 Restore default parameters UNSIGNED32 Write 0x64616F6C ("load")
0x1017 Producer heartbeat time UNSIGNED16 ms
0x1018 Identity object RECORD :01 vendor ID, :02 product code, :03 revision, :04 serial number
0x1400–0x1403 RPDO communication parameters RECORD COB-ID, transmission type
0x1600–0x1603 RPDO mapping RECORD Mapped objects
0x1800–0x1803 TPDO communication parameters RECORD COB-ID, transmission type, event timer
0x1A00–0x1A03 TPDO mapping RECORD Mapped objects
0x603F Error code UNSIGNED16 Last error
0x6040 Controlword UNSIGNED16 See above
0x6041 Statusword UNSIGNED16 See above
0x605A Quick stop option code INTEGER16 Quick stop behaviour
0x6060 Modes of operation INTEGER8 See above
0x6061 Modes of operation display INTEGER8 Active mode
0x6064 Position actual value INTEGER32 Position units (TBD)
0x606C Velocity actual value INTEGER32 Velocity units (TBD)
0x6071 Target torque INTEGER16 Per mille of rated torque
0x6072 Max torque UNSIGNED16 Per mille of rated torque
0x6076 Motor rated torque UNSIGNED32 mN·m (TBD)
0x6077 Torque actual value INTEGER16 Per mille of rated torque
0x607A Target position INTEGER32 Position units (TBD)
0x60FF Target velocity INTEGER32 Velocity units (TBD)
0x6502 Supported drive modes UNSIGNED32 Bit field, see above

Drive-specific objects (0x2000–0x5FFF) are not defined yet.

Cyclic control with PDOs and SYNC

A PDO is one CAN frame that carries mapped objects with no request and no response. Use PDOs for control loops. With synchronous PDOs the host sends a SYNC frame (0x080) each cycle; the drive applies the last RPDO and sends its TPDOs at each SYNC.

This example maps:

PDO Direction Contents Transmission type
RPDO1 Host → drive Controlword 0x6040, target torque 0x6071 1: applied at the next SYNC
TPDO1 Drive → host Statusword 0x6041, torque actual value 0x6077 1: sent after every SYNC
TPDO2 Drive → host Position actual value 0x6064, velocity actual value 0x606C 1: sent after every SYNC

It then enables the drive in cyclic synchronous torque mode (10) through RPDO1, applies a torque for 0.5 s and prints position, velocity and torque. The SYNC period limits of the drive are TBD.

Warning Keep hands, cables and tools away from the output face while the script runs.

import sys
import time

import canopen

node_id = int(sys.argv[1], 0)          # node ID, e.g. 0x0A
eds = sys.argv[2]                      # path to the device description file (not released yet)
torque = int(sys.argv[3])              # target torque in per mille of rated torque (0x6076)
PERIOD_S = 0.002                       # SYNC period; the drive's limits are TBD

network = canopen.Network()
network.connect(interface="socketcan", channel="can0")
node = network.add_node(node_id, eds)

# PDO mapping can only change in NMT pre-operational.
node.nmt.state = "PRE-OPERATIONAL"

node.rpdo.read()
node.rpdo[1].clear()
node.rpdo[1].add_variable(0x6040)      # controlword
node.rpdo[1].add_variable(0x6071)      # target torque
node.rpdo[1].trans_type = 1            # act on the next SYNC
node.rpdo[1].enabled = True
node.rpdo.save()

node.tpdo.read()
node.tpdo[1].clear()
node.tpdo[1].add_variable(0x6041)      # statusword
node.tpdo[1].add_variable(0x6077)      # torque actual value
node.tpdo[1].trans_type = 1            # send after every SYNC
node.tpdo[1].enabled = True
node.tpdo[2].clear()
node.tpdo[2].add_variable(0x6064)      # position actual value
node.tpdo[2].add_variable(0x606C)      # velocity actual value
node.tpdo[2].trans_type = 1
node.tpdo[2].enabled = True
node.tpdo.save()

node.sdo[0x6072].raw = abs(torque)     # max torque
node.sdo[0x6060].raw = 10              # cyclic synchronous torque

rpdo = node.rpdo[1]
rpdo[0x6040].raw = 0x0006              # Shutdown
rpdo[0x6071].raw = 0
rpdo.start(PERIOD_S)                   # send RPDO1 every period
network.sync.start(PERIOD_S)           # send SYNC every period
node.nmt.state = "OPERATIONAL"


def wait_for_state(mask, value, timeout_s=1.0):
    end = time.monotonic() + timeout_s
    while time.monotonic() < end:
        node.tpdo[1].wait_for_reception(timeout=0.1)
        if node.tpdo[1][0x6041].raw & mask == value:
            return
    raise RuntimeError(f"statusword 0x{node.tpdo[1][0x6041].raw:04X}")


try:
    wait_for_state(0x006F, 0x0021)     # Ready to switch on
    rpdo[0x6040].raw = 0x0007          # Switch on
    wait_for_state(0x006F, 0x0023)
    rpdo[0x6040].raw = 0x000F          # Enable operation
    wait_for_state(0x006F, 0x0027)

    rpdo[0x6071].raw = torque
    end = time.monotonic() + 0.5
    while time.monotonic() < end:
        node.tpdo[2].wait_for_reception(timeout=0.1)
        print(node.tpdo[2][0x6064].raw, node.tpdo[2][0x606C].raw, node.tpdo[1][0x6077].raw)
finally:
    rpdo[0x6071].raw = 0
    rpdo[0x6040].raw = 0x0006          # Shutdown: torque off
    time.sleep(0.05)
    network.sync.stop()
    rpdo.stop()
    node.nmt.state = "PRE-OPERATIONAL"
    network.disconnect()

Run it:

python3 pdo_torque.py <node-id> <device-description-file>.eds <torque>

Note python-canopen sends the RPDO and the SYNC from two separate timers, so they are not locked in phase. That is enough for a test. In a real control loop, send the RPDO and then the SYNC once per cycle from a single loop.

Emergency messages (EMCY)

The drive sends an EMCY frame on 0x080 + node ID when an error occurs, and again when it clears. Watch for them with:

candump can0,080:780

The filter also passes the SYNC frame (0x080) if the host sends SYNC.

Bytes Content
0–1 Error code, little-endian. 0x0000 = error reset or no error.
2 Error register (copy of 0x1001)
3–7 Manufacturer-specific: TBD

The high byte of the error code gives the error class (CiA 301):

Error code Class
0x10xx Generic
0x2xxx Current
0x3xxx Voltage
0x4xxx Temperature
0x5xxx Device hardware
0x6xxx Device software
0x7xxx Additional modules
0x8xxx Monitoring
0x9xxx External error
0xF0xx Additional functions
0xFFxx Device-specific

The error codes the drive uses are TBD. The same faults are readable as diagnostic trouble codes over UDS.

In python-canopen, read EMCY messages from node.emcy:

node.emcy.add_callback(lambda e: print(f"EMCY 0x{e.code:04X} register 0x{e.register:02X}"))

ROS 2

A ROS 2 driver is part of the design. It is not released, and its interface is not defined yet.