Skip to main content

CiA 402 - Servo drive profile

CiA 402 is the CANopen device profile for drives and motion control equipment, the most widely used standard for servo drives.

Protocol overview​

What is CiA 402?​

Protocol layering:

EtherCAT application layer
└── CoE (CANopen over EtherCAT)
├── CiA 401 (general-purpose I/O module)
├── CiA 402 (drives and motion control) ← current profile
└── other CiA device profiles

What does CiA 402 define?​

CiA 402 defines the following in the 0x6000-0x67FF range of the CoE object dictionary (some cyclic synchronous objects extend to 0x68FF, for example 0x60FF target velocity):

  • Standard state machine: unified state transition logic for drives
  • Modes of operation: several motion control modes (position, velocity, torque and others)
  • Standard objects: unified control and feedback parameters
  • PDO mapping: real-time motion control data exchange
  • Interoperability: drives from different vendors can be exchanged

State machine​

CiA 402 defines a complete drive state machine

Main states​

StateDescriptionControlwordStatusword
Not ready to switch onInitialization state, the drive is not ready-xxxx xxxx x0xx 0000
Switch on disabledDrive disabled, commands can be received-xxxx xxxx x1xx 0000
Ready to switch onReady to switch on, voltage not enabled0x06xxxx xxxx x01x 0001
Switched onSwitched on, voltage enabled but not running0x07xxxx xxxx x01x 0011
Operation enabledOperation enabled, normal operation possible0x0Fxxxx xxxx x01x 0111
Quick stop activeQuick stop active0x02xxxx xxxx x00x 0111
Fault reaction activeFault reaction active-xxxx xxxx x0xx 1111
FaultFault state0x86 (bit7 rising edge, bit2=1)xxxx xxxx x0xx 1000

State transition commands​

CommandControlwordDescription
Shutdown0x06Shut down, enter Ready to switch on
Switch on0x07Switch on, enter Switched on
Enable operation0x0FEnable operation, enter Operation enabled
Disable voltage0x00Disable voltage, return to Switch on disabled
Quick stop0x02Quick stop
Fault reset0x86Fault reset (bit7 rising edge; bit2 must be 1 — with bit2=0, 0x80/0x00 also trigger Quick stop)

Advancement criteria (advance on the measured 0x6041)​

The controlwords in the table above are commands, not results. 0x06 → 0x07 → 0x0F must be sent step by step; after each step read 0x6041 to confirm the state has been reached before sending the next command. Do not advance open-loop on a fixed delay, and do not send all three steps in the same cycle.

Statusword maskStateNext step
(sw & 0x4F) == 0x40Switch on disabledSend 0x06
(sw & 0x6F) == 0x21Ready to switch onSend 0x07
(sw & 0x6F) == 0x23Switched onSend 0x0F
(sw & 0x6F) == 0x27Operation enabledHold 0x0F, motion allowed
(sw & 0x4F) == 0x08FaultClear the fault cause first, then execute fault reset

Exit path from Quick stop active: do not send 0x06 directly. First send 0x0000 (Disable voltage) to return to Switch on disabled, then advance again through 0x06 → 0x07 → 0x0F. The SDK's Enable() follows the same path for QuickStopActive.

Fault reset: bit7 of 0x6040 is rising-edge triggered, and bit2 must be 1. Therefore do not write 0x0080 or 0x0000 — bit2=0 in both values, and they also trigger Quick stop. The correct approach is to write 0x0006 first (bit7=0, bit2=1) and then 0x0086 (bit7 rising edge, bit2=1), with the two actions in consecutive cycles. The fault reset bit only takes effect in OP process data: under PreOp / SafeOp, writing 0x6040 over SDO does not reset faults such as 0x7500.

SDK call

CiA402Instance.FaultReset() already wraps 0x0006 → 0x0086 and the clearing of the 0x7500 synchronous error counter; however, it performs an SDO mailbox round trip, so it must not be called inside a PDO callback. On the real-time path, call FaultResetStep(0) / FaultResetStep(1) in two consecutive cycles instead.

Controlword and statusword​

Controlword (0x6040)​

BitNameDescription
0Switch onSwitch-on command
1Enable voltageEnable voltage
2Quick stopQuick stop (0=active)
3Enable operationEnable operation
4Operation mode specificNew setpoint
5Operation mode specificChange immediately
6Operation mode specificRelative
7Fault resetFault reset (rising edge)
8HaltHalt
9-10Operation mode specificOperation mode specific
11-15Manufacturer specificManufacturer specific

Common controlwords:

const ushort SHUTDOWN        = 0x06;  // 0000 0110
const ushort SWITCH_ON = 0x07; // 0000 0111
const ushort ENABLE_OP = 0x0F; // 0000 1111
const ushort DISABLE_VOLTAGE = 0x00; // 0000 0000
const ushort QUICK_STOP = 0x02; // 0000 0010
const ushort FAULT_RESET_LOW = 0x06; // 0000 0110: bit7=0, bit2=1 (reset low phase)
const ushort FAULT_RESET = 0x86; // 1000 0110: bit7 rising edge, bit2=1

Statusword (0x6041)​

BitNameDescription
0Ready to switch onReady
1Switched onSwitched on
2Operation enabledOperation enabled
3FaultFault
4Voltage enabledVoltage enabled
5Quick stopQuick stop (0=active)
6Switch on disabledSwitch on disabled
7WarningWarning
8Manufacturer specificManufacturer specific
9RemoteRemote mode
10Target reachedTarget reached
11Internal limit activeInternal limit active
12Operation mode specificSetpoint acknowledge
13Operation mode specificFollowing error
14-15Manufacturer specificManufacturer specific

The meaning of bit12 / bit13 depends on the mode of operation:

Modebit12bit13
PPSet-point acknowledge (the response in the bit4 handshake)Following error
HMHoming attained (homing complete)Homing error
IP / CSPMode specificMode specific (usually following error)

When judging the homing result, do not look only at bit12/bit13 of 0x6041; also read 0x6061 to confirm that the drive is still in HM mode. Once the mode has been switched, these two bits take on a different meaning.

Modes of operation​

Mode definitions (Modes of operation, 0x6060)​

ValueAbbreviationModeDescription
1PPProfile Position ModeProfile position mode, point-to-point motion
2VLVelocity ModeVelocity mode (non-cyclic velocity command, used by some drives)
3PVProfile Velocity ModeProfile velocity mode, velocity control
4PTProfile Torque ModeProfile torque mode, torque control
6HMHoming ModeHoming mode, establishes the position reference
7IPInterpolated Position ModeInterpolated position mode, trajectory tracking
8CSPCyclic Synchronous Position ModeCyclic synchronous position mode
9CSVCyclic Synchronous Velocity ModeCyclic synchronous velocity mode
10CSTCyclic Synchronous Torque ModeCyclic synchronous torque mode
11CSTCACyclic Synchronous Torque with Commutation AngleCyclic synchronous torque with commutation angle, a vendor extension mode
A mode code is not a promise of support

0x6060 being writable does not mean the drive supports that mode. After writing, read 0x6061 back to confirm; if the two differ, check Supported Modes in the ESI or the device manual.

Mode details​

PP - Profile Position Mode​

Characteristics:

  • Point-to-point motion
  • Internal trajectory planning
  • Trapezoidal / S-curve velocity profile

Main objects:

  • 0x607A: Target position
  • 0x6081: Profile velocity
  • 0x6083: Profile acceleration
  • 0x6084: Profile deceleration

CSP - Cyclic Synchronous Position Mode​

Characteristics:

  • Cyclic position command
  • Trajectory planning in the master
  • Highest real-time performance
  • Requires DC Sync0 synchronization

Main objects:

  • 0x607A: Target position (updated every cycle)
  • 0x60B0: Position offset (added to the target position)
  • 0x60B1: Velocity offset (used for CSP feedforward)
  • 0x60B2: Torque offset (used for CSP feedforward)
  • 0x60C2: Interpolation time period

CSP feedforward: writing 0x607A alone is not enough for CSP. Write velocity feedforward to 0x60B1, torque feedforward to 0x60B2 and fine position correction to 0x60B0; the drive adds all three offsets to the cyclic command. Whether they are supported, their units and their limits are defined by the device manual.

Interpolation cycle (0x60C2): 0x60C2:01 is the value and 0x60C2:02 is the decimal exponent, so the actual cycle = value × 10^exponent seconds (the exponent is negative, for example 1 × 10^-3 = 1 ms). It must be aligned with the master LoopCycle, for example:

Master cycle0x60C2:010x60C2:02
1 ms1-3
500 µs50-5
125 µs125-6

After writing, read 0x60C2 and 0x6061 back to confirm. Some drives require 0x60C2 / 0x6060 to be written after the SafeOp mapping has been completed; values written in PreOp are cleared. The write timing is defined by the device manual.

Multi-axis synchronization: all axes on the same master should be computed in one and the same ProcessDataCyclicSync callback, in a fixed order within one cycle, and only then written to 0x607A. Do not attach a separate timer or an independent callback to each axis — the commands for each axis would then take effect at different moments within the cycle, and coupled axes (gears, cams, gantries) would show intermediate states. Blocking calls such as SDO, FaultReset() and Thread.Sleep are forbidden inside the callback.

CSV - Cyclic Synchronous Velocity Mode​

Characteristics:

  • Cyclic velocity command
  • Suited to velocity following

Main objects:

  • 0x60FF: Target velocity
  • 0x60B2: Torque offset

CST - Cyclic Synchronous Torque Mode​

Characteristics:

  • Cyclic torque command
  • Force control applications

Main objects:

  • 0x6071: Target torque

Common objects​

Control and status​

IndexNameTypeAccessDescription
0x6040ControlwordUNSIGNED16RW/RXPDOControlword
0x6041StatuswordUNSIGNED16RO/TXPDOStatusword
0x6060Modes of operationINTEGER8RWMode of operation
0x6061Modes of operation displayINTEGER8ROActual mode of operation

Position objects​

IndexNameTypeUnitDescription
0x6062Position demand valueINTEGER32user unitsPosition demand value
0x6063Position actual internal valueINTEGER32internal incrementsActual position (internal)
0x6064Position actual valueINTEGER32user unitsActual position
0x607ATarget positionINTEGER32user unitsTarget position
0x607CHome offsetINTEGER32user unitsHome offset
0x607DSoftware position limitARRAYuser unitsSoftware position limit
User units are not encoder increments

0x6062 / 0x6064 / 0x607A / 0x607C / 0x607D all use user units (counts, mm, rad and so on after scaling through 0x6091/0x6092/0x6093); 0x6063 is the unscaled internal encoder increment. The two values are usually not equal — never use 0x6063 directly as 0x6064, and never assume "1 count = 1 user unit".

Velocity objects​

IndexNameTypeUnitDescription
0x606BVelocity demand valueINTEGER32user unitsVelocity demand value
0x606CVelocity actual valueINTEGER32user unitsActual velocity
0x60FFTarget velocityINTEGER32user unitsTarget velocity
0x6081Profile velocityUNSIGNED32user unitsProfile velocity
0x6083Profile accelerationUNSIGNED32user units/s²Profile acceleration
0x6084Profile decelerationUNSIGNED32user units/s²Profile deceleration

Torque objects​

IndexNameTypeUnitDescription
0x6071Target torqueINTEGER16per mille of ratedTarget torque
0x6077Torque actual valueINTEGER16per mille of ratedActual torque
0x60B2Torque offsetINTEGER16per mille of ratedTorque offset

Code examples​

Servo enable sequence​

// servo is a slave instance that has already entered OP
var servo = master.Slaves[0];
var drv = servo.CoE?.CiA402; // slave.CoE is CoEInstance?, use ?. to avoid a null reference

// null has two meanings: the device is confirmed not to be CiA402, or 0x1000 cannot be read right now (retried once communication recovers)
if (drv == null)
{
LogManager.Instance.AddLog(LogCategory.Error, $"从站 {servo.SlaveNum} 的 CiA402 实例不可用"); // The CiA402 instance for slave {servo.SlaveNum} is unavailable
return;
}

int enableFailCycles = 0;

// Recommended: use the CiA402Instance property (non-blocking, called every PDO cycle)
master.Events.ProcessDataCyclicSync += (masterIndex) =>
{
// Enable() returns bool: true=reached OperationEnabled, false=still transitioning or failed
if (drv.Enable())
{
enableFailCycles = 0;
return;
}

// A false must not be swallowed silently: look at the state first and tell "transitioning" from "fault/timeout"
enableFailCycles++;
StateCiA402 state = drv.StateDrive;
if (state == StateCiA402.Fault || state == StateCiA402.FaultReactionActive)
{
// Fault is not reset automatically by Enable(); a fault reset must be executed explicitly
LogManager.Instance.AddLog(LogCategory.Error,
$"从站 {servo.SlaveNum} 故障: 0x603F=0x{drv.ErrorCode:X4}, 需先 FaultReset"); // Slave {servo.SlaveNum} fault: 0x603F=0x{drv.ErrorCode:X4}, FaultReset required first
}
else if (enableFailCycles > 100) // 1 ms cycle, still not enabled after about 100 ms
{
LogManager.Instance.AddLog(LogCategory.Error,
$"从站 {servo.SlaveNum} 使能超时: state={state}, SW=0x{drv.Statusword:X4}"); // Slave {servo.SlaveNum} enable timeout: state={state}, SW=0x{drv.Statusword:X4}
}
};

Position mode (PP)​

var servo = master.Slaves[0];
var drv = servo.CoE?.CiA402;
if (drv == null) return;

// 1. Configure the mode of operation and the motion parameters (through the OD properties), then read 0x6061 to confirm
drv.OperationMode = ModeCiA402.PP;
drv.ProfileVelocity = 1000;
drv.ProfileAcceleration = 5000;
drv.ProfileDeceleration = 5000;

// 2. Check soft limits on the command side first; never hand an out-of-range target to the drive to reject or clamp
const int target = 100000;
if (target < drv.SoftwarePositionLimitMin || target > drv.SoftwarePositionLimitMax)
{
LogManager.Instance.AddLog(LogCategory.Error,
$"目标 {target} 超出软限位 [{drv.SoftwarePositionLimitMin}, {drv.SoftwarePositionLimitMax}]"); // Target {target} exceeds the soft limit [{drv.SoftwarePositionLimitMin}, {drv.SoftwarePositionLimitMax}]
return;
}

int ppStep = 0;

// 3. Enable in the PDO callback and advance the bit4/bit12 handshake
master.Events.ProcessDataCyclicSync += (masterIndex) =>
{
if (!drv.Enable()) return; // Production code must record state/alarm as in the previous section; it must not silently return

switch (ppStep)
{
case 0: // Trigger: bit4 rising edge
drv.NewSetpoint(target);
ppStep = 1;
break;

case 1: // Wait for the drive to confirm bit12 (Set-point acknowledge)
if ((drv.Statusword & 0x1000) != 0)
{
drv.ClearNewSetpoint(); // bit4 returns to 0
ppStep = 2;
}
break;

case 2: // Wait for bit12 to clear; the handshake is then done
if ((drv.Statusword & 0x1000) == 0)
ppStep = 3;
break;

case 3: // Wait for bit10 (Target reached)
if (drv.TargetReached)
{
LogManager.Instance.AddLog(LogCategory.Message, $"从站 {servo.SlaveNum} 到达目标位置 {target}"); // Slave {servo.SlaveNum} reached target position {target}
ppStep = 4;
}
break;
}
};
Do not clear bit4 with TargetReached

The PP handshake order is 0x0F → 0x1F → 等 bit12 → 0x0F → 等 bit12 清除 → 等 bit10. TargetReached (bit10) only indicates that the target has been reached and cannot replace Set-point acknowledge (bit12); using it to clear bit4 makes the drive treat the new setpoint as cancelled midway.

Cyclic synchronous position mode (CSP)​

var servo = master.Slaves[0];
var drv = servo.CoE?.CiA402;
if (drv == null) return;

// 1. Configure the mode of operation and the interpolation cycle, then read back to confirm
drv.OperationMode = ModeCiA402.CSP;
drv.InterpolationTimePeriodValue = 1; // 0x60C2:01, 1 ms cycle time
drv.InterpolationTimePeriodIndex = -3; // 0x60C2:02, actual cycle = 1 x 10^-3 s
// The drv.OperationMode getter reads 0x6061; if it does not agree with CSP, stop sending positions

// 2. The first cycle target must equal the actual position to avoid a power-on jump
int target = drv.PositionActual;
const int maxDeltaPerCycle = 100; // Convert the velocity limit into a maximum increment per cycle

double angle = 0;
master.Events.ProcessDataCyclicSync += (masterIndex) =>
{
if (!drv.Enable()) return; // Production code must record state/alarm; it must not silently return

// Generate a trajectory (example: sine wave)
int desired = (int)(10000 * Math.Sin(angle));
angle += 0.01;

// Clamping on the command side: per-cycle increment + soft limits, not relying on the drive to bail you out
int delta = Math.Clamp(desired - target, -maxDeltaPerCycle, maxDeltaPerCycle);
target += delta;
if (target < drv.SoftwarePositionLimitMin || target > drv.SoftwarePositionLimitMax)
{
LogManager.Instance.AddLog(LogCategory.Error,
$"CSP 目标 {target} 超出软限位 [{drv.SoftwarePositionLimitMin}, {drv.SoftwarePositionLimitMax}]"); // CSP target {target} exceeds the soft limit [{drv.SoftwarePositionLimitMin}, {drv.SoftwarePositionLimitMax}]
return;
}

// Velocity/torque feedforward can be superimposed (0x60B1 / 0x60B2); keep them at 0 when unused
drv.TargetPosition = target;
};

Units and scaling​

Position units​

Position scaling is determined by the Factor Group; the common objects are:

  • 0x6091: Gear ratio (sub-index 1 = motor revolutions, sub-index 2 = load shaft revolutions)
  • 0x6092: Feed constant (sub-index 1 = feed per revolution, sub-index 2 = load shaft revolutions)
  • 0x6093: Position factor (sub-index 1 = numerator, sub-index 2 = denominator)
  • 0x6094: Velocity encoder factor

0x6093 converts internal encoder increments into user position units. Vendors do not agree on the direction of the numerator/denominator or on how 0x6091 / 0x6092 combine with 0x6093; some drives use only 0x6093, while others fold the gear ratio and the feed constant in as well. Do not apply one universal formula:

Common implementation (illustrative only; follow the device manual):
User position = internal increments × (0x6093:01 / 0x6093:02) × (gear ratio / feed constant)

Engineering practice:

  1. First decide on the user unit (counts, mm, rad or degrees), then configure 0x6091 / 0x6092 / 0x6093 according to the device manual.
  2. Express the ratio with large integer numerator/denominator values (for example 0x20000 / 0x10000) to avoid rounding error from small ratio values.
  3. After configuration, command a known displacement (for example 10 mm) and read back 0x6064 and 0x6063 to compare, confirming that the scaling really took effect; do not write without verifying.

Velocity units​

Velocity objects (0x606B / 0x606C / 0x60FF / 0x6081) use user velocity units per second. Velocity scaling also involves 0x6094 (Velocity encoder factor) and 0x6095 / 0x6096 (Velocity factor 1/2); 0x6097 is the acceleration factor. Not every drive supports all factor objects; where an object is missing, use the equivalent parameter given in the manual.

Acceleration units​

0x6083 / 0x6084 / 0x609A are in user units/s². When the position user unit is mm the result is mm/s²; when the position user unit is counts the result is counts/s². It is tied to position scaling, so after changing 0x6093 you must re-check the acceleration values.

Torque units​

Thousandths of rated torque (1000 = 100%). 0x6071 / 0x6077 / 0x60B2 all use this convention.

Homing mode​

Homing method (0x6098)​

Method numberReference signalDescription
1-2Limit switch + zero signalNegative/positive limit direction; after hitting the limit, search for the zero pulse
3-6Home switch + zero signalRising/falling edge of the home switch, with direction combinations
7-14Home switch + zero signalFiner combinations with direction and zero pulse
17-18Home switchSearch for the home switch only, not the zero signal
19-30Home switch + zero signalCombinations of home switch and encoder zero pulse (including direction)
33-34Zero signalEncoder zero pulse only, negative/positive direction
35Current positionSet the current position directly as the home position
Homing direction and home offset

The homing method number itself encodes the search direction. Changing the method number changes the approach direction; you cannot change only the velocity and leave the method unchanged.

After homing, the position reference is shifted by 0x607C (home offset, user units): the sign of 0x607C determines which way the zero position moves. After changing 0x607C you must home again or rebuild the position reference; do not assume the drive recalculates automatically.

Homing velocity and acceleration​

IndexSub-indexNameTypeDescription
0x609901Speed during search for switchUNSIGNED32Velocity while searching for the reference signal (fast)
0x609902Speed during search for zeroUNSIGNED32Velocity while searching for zero (slow)
0x609A00Homing accelerationUNSIGNED32Acceleration and deceleration during homing

Notes:

  • 0x6099:01 — homing search velocity, used to approach the limit switch or home switch quickly
  • 0x6099:02 — homing zero velocity, used to locate the encoder zero signal precisely at slow speed
  • 0x609A — homing acceleration, controls acceleration and deceleration during homing. Applies to all homing methods

Homing sequence​

var servo = master.Slaves[0];
var drv = servo.CoE?.CiA402;
if (drv == null) return;

// 1. Configure the homing parameters (through the OD properties), then read 0x6061 to confirm HM
drv.OperationMode = ModeCiA402.HM;
drv.HomingMethod = 1; // The method number decides the search direction; do not only change the speed
drv.HomingSpeedSearch = 500;
drv.HomingSpeedZero = 100;
drv.HomingAcceleration = 1000;
drv.HomeOffset = 0; // 0x607C, zero offset after homing (user units); the sign sets the direction

bool homingStarted = false;
bool homingDone = false;

// 2. Enable and run homing inside the PDO callback
master.Events.ProcessDataCyclicSync += (masterIndex) =>
{
if (homingDone || !drv.Enable()) return;

if (!homingStarted)
{
drv.StartHoming(); // 0x6040 bit4 = 1
homingStarted = true;
}

if (drv.HomingAttained)
{
homingDone = true;
LogManager.Instance.AddLog(LogCategory.Message, $"从站 {servo.SlaveNum} 回零完成, 0x6064={drv.PositionActual}"); // Slave {servo.SlaveNum} homing complete, 0x6064={drv.PositionActual}
}
else if (drv.HomingError)
{
homingDone = true;
LogManager.Instance.AddLog(LogCategory.Error, $"从站 {servo.SlaveNum} 回零错误, 0x603F=0x{drv.ErrorCode:X4}"); // Slave {servo.SlaveNum} homing error, 0x603F=0x{drv.ErrorCode:X4}
}
};

Statusword parsing​

// Recommended: use the CiA402Instance property to get the state directly
var drv = servo.CoE?.CiA402;
if (drv == null) return;
var state = drv.StateDrive;
Console.WriteLine($"驱动状态: {state.GetDescription()}"); // Drive state: {state.GetDescription()}

// Or use the static method to parse the raw status word
ushort sw = drv.Statusword;
var parsed = CiA402Instance.ParseState(sw);
Console.WriteLine($"状态字: 0x{sw:X4} → {parsed}"); // Status word: 0x{sw:X4} → {parsed}