Getting started

Last updated 2026-11-27

This page takes one drive from the box to a first, torque-limited move on the bench. You mount the drive, wire the bus and the supply, find the drive on the CAN bus, read its identity and run a short torque pulse. It uses a Linux PC and Python.

You need

1. Install the tools

Install can-utils, then the Python libraries used on these pages in a virtual environment:

sudo apt install can-utils python3-venv
python3 -m venv ~/apsis-venv
source ~/apsis-venv/bin/activate
pip install python-can canopen can-isotp udsoncan

Run the Python examples from this environment.

2. Mount the drive

Warning Do not remove the 12 × M3 countersunk screws in the back plate. Do not use the 3 × M5 holes in the output face; they are for the assembly fixture only. See Mechanical integration.

  1. Bolt the fixture to the M4 holes on the top of the rim.
  2. Leave the output face free. Do not fit a link or load yet.
  3. With the drive unpowered, turn the output face slowly by hand through one full turn. It should turn without binding.

If the output binds, stop and do not apply power. See Troubleshooting.

3. Wire the bus and the supply

  1. Switch the supply off.
  2. Connect CAN_H, CAN_L and CAN ground between the adapter and the drive. Pin-out: TBD.
  3. Fit a 120 Ω resistor between CAN_H and CAN_L at each end of the bus: one at the adapter and one at the drive. Whether the drive has built-in termination is TBD.
  4. With everything unpowered, measure the resistance between CAN_H and CAN_L. You should read about 60 Ω (two 120 Ω resistors in parallel).
  5. Fit the fuse in the positive supply line, then connect the supply to the drive.
  6. Set the supply to 48 V. Set the current limit low.

4. Bring up the CAN interface

The drive's factory bit rates are not defined yet. The commands below use 1 Mbit/s for arbitration and 5 Mbit/s for data. Replace them with the drive's values when they are published.

sudo ip link set can0 type can bitrate 1000000 dbitrate 5000000 fd on
sudo ip link set can0 up
ip -details link show can0

In the output, check for mtu 72 (CAN FD frames enabled) and state ERROR-ACTIVE. CAN FD on Linux explains the options and the output.

5. Power on and find the drive

Open a second terminal and start a capture:

candump -td can0

Switch the supply on. As a CANopen device, the drive sends a boot-up message when it starts: CAN ID 0x700 + <node-id>, one data byte 00.

 (000.000000)  can0  7NN   [1]  00

NN is the node ID in hexadecimal. For example, 70A means node ID 0x0A (10). The factory node ID is TBD, so read it from this frame.

If heartbeats are enabled, the same CAN ID then repeats at a fixed interval. The data byte gives the NMT state: 7F pre-operational, 05 operational, 04 stopped. The factory heartbeat setting is TBD.

If no frame appears, see Troubleshooting before you continue.

6. Read the identity

Save this as identity.py. It reads standard CANopen objects with SDO requests, so it does not need the device description file.

import struct
import sys

import canopen

node_id = int(sys.argv[1], 0)          # node ID from the boot-up message, e.g. 0x0A

network = canopen.Network()
network.connect(interface="socketcan", channel="can0")
node = network.add_node(node_id)       # raw SDO access; no device description file needed


def read_u32(index, subindex):
    return struct.unpack("<I", node.sdo.upload(index, subindex))[0]


device_type = read_u32(0x1000, 0)
print(f"device type     0x{device_type:08X} (profile {device_type & 0xFFFF})")
print(f"vendor ID       0x{read_u32(0x1018, 1):08X}")
print(f"product code    0x{read_u32(0x1018, 2):08X}")
print(f"revision        0x{read_u32(0x1018, 3):08X}")
print(f"serial number   0x{read_u32(0x1018, 4):08X}")
print(f"error register  0x{node.sdo.upload(0x1001, 0)[0]:02X}")
print(f"statusword      0x{struct.unpack('<H', node.sdo.upload(0x6041, 0))[0]:04X}")

network.disconnect()

Run it with the node ID from step 5:

python3 identity.py <node-id>

Check the output:

The vendor ID, product code and revision values are TBD. Sub-indices 2 to 4 of 0x1018 are optional in CiA 301; which of them the drive fills is TBD. The drive also reports its serial number, hardware revision and firmware version over UDS.

7. Run a torque pulse

This script switches the drive to profile torque mode, enables it, applies a torque for 0.5 s, sets the torque back to zero and switches torque off. It also limits the maximum torque (0x6072) to the value you pass.

Warning Keep hands, cables and tools away from the output face. Check that the fixture is bolted down. Start with a small torque value: the output carries no load and accelerates freely.

Save this as first_move.py:

import struct
import sys
import time

import canopen

node_id = int(sys.argv[1], 0)          # node ID, e.g. 0x0A
torque = int(sys.argv[2])              # target torque in per mille of rated torque (0x6076)
PULSE_S = 0.5                          # how long the torque is applied

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


def read(index, fmt):
    return struct.unpack(fmt, node.sdo.upload(index, 0))[0]


def write(index, fmt, value):
    node.sdo.download(index, 0, struct.pack(fmt, value))


def wait_for_state(mask, value, timeout_s=1.0):
    end = time.monotonic() + timeout_s
    while True:
        sw = read(0x6041, "<H")
        if sw & mask == value:
            return
        if time.monotonic() > end:
            raise RuntimeError(f"statusword 0x{sw:04X}: expected 0x{value:04X} under mask 0x{mask:04X}")
        time.sleep(0.01)


if not read(0x6502, "<I") & (1 << 3):  # bit 3: profile torque mode
    sys.exit("drive does not report profile torque mode")

write(0x6072, "<H", abs(torque))       # max torque: clamp to the test value
write(0x6071, "<h", 0)                 # target torque: zero before enabling
write(0x6060, "<b", 4)                 # modes of operation: 4 = profile torque
if read(0x6061, "<b") != 4:
    sys.exit("drive did not switch to profile torque mode")

try:
    write(0x6040, "<H", 0x0006)        # Shutdown
    wait_for_state(0x006F, 0x0021)     # Ready to switch on
    write(0x6040, "<H", 0x0007)        # Switch on
    wait_for_state(0x006F, 0x0023)     # Switched on
    write(0x6040, "<H", 0x000F)        # Enable operation
    wait_for_state(0x006F, 0x0027)     # Operation enabled

    start = read(0x6064, "<i")         # position actual value
    write(0x6071, "<h", torque)
    time.sleep(PULSE_S)
    write(0x6071, "<h", 0)
    print("position change:", read(0x6064, "<i") - start)
finally:
    write(0x6040, "<H", 0x0006)        # Shutdown: torque off
    write(0x6040, "<H", 0x0000)        # Disable voltage: back to Switch on disabled
    network.disconnect()

Run it with a small torque value, in per mille of rated torque:

python3 first_move.py <node-id> <torque>

The output face turns briefly and the script prints the position change. The rated torque (0x6076) and the position units (0x6064) are TBD, so the numbers are relative for now. A negative torque value turns the output the other way.

If the script stops with a statusword error, the drive did not reach the expected state. Read the state from the statusword with the table in CANopen (CiA 402), then see Troubleshooting.

Note python-canopen also has a CiA 402 helper class, canopen.BaseNode402, that runs the state machine for you. This page writes the controlword directly so that each transition is visible.

Next steps