How-to
EtherCAT servo position control: ESM, PDO, and CiA 402 sequence
Short answer
To run EtherCAT servo position control without a motion library, step the EtherCAT State Machine sequentially through INIT, PRE-OP, SAFE-OP, and OP, then hold OP in a fixed-period cyclic loop. Configure your CiA 402 process data mapping and Sync Manager assignments in PRE-OP before entering SAFE-OP. Once in OP, preload target position from actual position, enable the power stage with controlword commands 0x0006, 0x0007, and 0x000F, and stream ramped target increments.

On this page
- What prerequisites decide if a raw EtherCAT master can run your servo drive?
- How do you step the EtherCAT State Machine from INIT to OP without errors?
- Which CiA 402 objects do you map in PRE-OP for position control?
- What controlword sequence enables a CiA 402 servo drive in OP?
- How do you calculate cyclic position targets without a motion library?
- Which AL status codes and drive alarms pinpoint setup faults?
- What step-by-step commissioning sequence verifies EtherCAT position control?
- Questions asked
Moving an AC servo drive over EtherCAT from a raw master without a motion library requires two state machines running in order: the EtherCAT State Machine (ESM) for cyclic transport and the CiA 402 power state machine for torque and position control. Reaching Operational state alone never moves the shaft, and skipping from INIT to OP or dropping immediately back to PRE-OP breaks cyclic data exchange.
Step the ESM sequentially through INIT, PRE-OP, SAFE-OP, and OP, map CiA 402 objects in PRE-OP, hold OP in a timed loop, preload target position, and step the controlword to Operation Enabled.
What prerequisites decide if a raw EtherCAT master can run your servo drive? #
Four checks confirm readiness before you write control code: physical link on the drive IN port, EtherCAT master driver support on your controller, confirmed CoE support on the drive variant, and the matching vendor ESI file. Connect the master Ethernet port to the drive IN connector, never OUT, apply control power, and verify link LEDs on both ends before scanning. If the link is up yet the scan finds zero slaves, confirm your real-time controller has an EtherCAT master driver installed and bound to that Ethernet port.
Verify the exact fieldbus option in the drive manual rather than assuming support from a label; confirming what an EtherCAT label tells you about a servo drive prevents wiring an incompatible variant. On a Panasonic MINAS-A5B driver such as model MCDHT3520BA1, check the MINAS-A5B EtherCAT Communication Specifications (Doc ID SX-DSV02473) and import its revision-matched ESI XML. Without a motion library such as NI SoftMotion, your application also owns trajectory generation.
How do you step the EtherCAT State Machine from INIT to OP without errors? #
Write state requests sequentially to the 16-bit AL Control register 0x0120 through INIT (0x01), PRE-OP (0x02), SAFE-OP (0x04), and OP (0x08), verifying AL Status register 0x0130 matches each state with AL Status Code 0x0134 equal to 0x0000. Under EtherCAT Technology Group specifications ETG.1000.6 and ETG.1020, each ESC exposes those three register pairs (0x0120:0x0121, 0x0130:0x0131, and 0x0134:0x0135), using bits 3 to 0 for state codes and bit 4 for Error Indication in AL Status or Error Acknowledgment in AL Control. Never jump directly from INIT to OP, and never step OP straight back to PRE-OP instead of holding OP in a fixed-period cyclic loop.
| State | Code | Active channel | Required before leaving |
|---|---|---|---|
| INIT | 0x01 |
None | Configure mailbox Sync Managers |
| PRE-OP | 0x02 |
Mailbox (SDO) | Map PDOs, assign Sync Managers, set mode |
| SAFE-OP | 0x04 |
SDO plus TxPDO inputs | Send valid RxPDO outputs; finish DC sync if used |
| OP | 0x08 |
TxPDO inputs and RxPDO outputs | Hold in fixed-period loop until stop |
On NI CompactRIO targets using NI-Industrial Communications for EtherCAT, call GetState, SetState, and QueryLastError via an Invoke Node on the IndComECAT Slave Class refnum. Switch the NI Scan Engine to Configuration Mode before SetState (calling it in Active Mode returns error -2147138483), and poll GetState or GetSlaveStates instead of calling Open Slave inside loops (which triggers RPC dropout -2147138446). When INIT to PRE-OP fails on an EEPROM mismatch, follow the steps for recovering an EtherCAT slave that fails INIT to PRE-OP from EEPROM errors.
Which CiA 402 objects do you map in PRE-OP for position control? #
Map six core CiA 402 objects in PRE-OP through Sync Manager assignment objects 0x1C12 and 0x1C13: Controlword, Target position, and Modes of operation in RxPDO, plus Statusword, Position actual value, and Modes of operation display in TxPDO. A servo drive ignores position targets unless Sync Manager 2 carries RxPDO outputs and Sync Manager 3 carries TxPDO inputs. Verify fixed versus flexible mapping against the drive ESI; if process data looks blank, check why an EtherCAT servo drive shows an empty process data tab.
| Direction | Index | Object | Type | Role |
|---|---|---|---|---|
| RxPDO | 0x6040 |
Controlword | 16-bit unsigned | Steps CiA 402 state machine |
| RxPDO | 0x607A |
Target position | 32-bit signed | Commanded position in counts |
| RxPDO or SDO | 0x6060 |
Modes of operation | 8-bit signed | Selects CSP (8) or Profile Position (1) |
| TxPDO | 0x6041 |
Statusword | 16-bit unsigned | Reports drive state and faults |
| TxPDO | 0x6064 |
Position actual value | 32-bit signed | Live encoder feedback in counts |
| TxPDO | 0x6061 |
Modes of operation display | 8-bit signed | Confirms active control mode |
All three objects per direction total 56 bits (7 bytes), or 48 bits (6 bytes) when Modes of operation is written once by SDO in PRE-OP, subject to any padding or fixed PDO layout in the drive ESI. When remapping flexible PDOs by SDO in PRE-OP, write 0 to subindex 0 of the assignment and mapping objects, write the ordered entries, and restore subindex 0; read any SDO abort code before retrying.
What controlword sequence enables a CiA 402 servo drive in OP? #
Read the Statusword in each OP cycle and step the Controlword sequentially through Shutdown (0x0006), Switch On (0x0007), and Enable Operation (0x000F), copying Position actual value into Target position before writing 0x000F so the shaft stays stationary. EtherCAT OP delivers frames, but the IEC 61800-7-201 (CiA 402) state machine controls motor energization. Mask the Statusword each cycle and hold each Controlword command until the drive confirms the next state.
Statusword check (0x6041) |
Drive state | Controlword write (0x6040) |
|---|---|---|
status & 0x0008 != 0 |
Fault | Clear cause, then pulse 0x0000 to 0x0080 |
status & 0x004F == 0x0040 |
Switch on disabled | 0x0006 (Shutdown) |
status & 0x006F == 0x0021 |
Ready to switch on | 0x0007 (Switch on) |
status & 0x006F == 0x0023 |
Switched on | Preload 0x607A from 0x6064, then 0x000F |
status & 0x006F == 0x0027 |
Operation enabled | Hold 0x000F, stream targets |
If the drive stays at Switch on disabled after Shutdown, check hardware Safe Torque Off (STO), interlocks, and main power rather than software; this is the same cause behind why a drive can report position over CiA 402 without moving. Before enabling torque or clearing faults, verify STO and lockout provisions under ISO 13849-1, IEC 61800-5-2, and the machine's risk assessment; this sequence is not a safety validation.
How do you calculate cyclic position targets without a motion library? #
Set Modes of operation to 8 for Cyclic Synchronous Position mode, confirm Modes of operation display echoes 8, and compute each cycle's position increment from target speed, effective encoder resolution, and your fixed loop period. In CSP mode, the drive tracks each cyclic target immediately without onboard profile generation, matching how cyclic position targets drive a servo every scan. If your drive manual confirms Profile Position mode (mode 1) and you only need point-to-point single-axis moves, Profile Position shifts ramp generation onto the drive.
In CSP mode, run the step arithmetic first. This is a calculated example for illustrative inputs, not a measured result or a catalog rating (take actual resolution and electronic gearing from the drive datasheet): a fixed loop period of 2 ms (500 Hz), effective resolution of 10,000 counts/rev, commissioning speed of 60 rpm (1 rev/s), and initial Position actual value of 42,500 counts.
Converting the loop period to 0.002 s gives a steady step of (60 rpm / 60 s/min) * 10,000 counts/rev * 0.002 s = 20 counts/cycle. Leaving Target position at 0 counts while actual feedback reads 42,500 counts injects a 4.25 rev error in one scan, equivalent to (4.25 rev / 0.002 s) * 60 s/min = 127,500 rpm, triggering a following-error trip or sudden jerk; preloading actual feedback cuts enable error to zero.
Jumping from zero to 20 counts/cycle in one scan demands (1 rev/s) / 0.002 s = 500 rev/s^2. Ramping by 1 count/cycle over 20 cycles (0.04 s) lowers acceleration to (1 rev/s) / 0.04 s = 25 rev/s^2 across 210 counts (0.021 rev). Commit to Profile Position mode for point-to-point moves without a motion library, and use CSP only with a master-side ramp.
Which AL status codes and drive alarms pinpoint setup faults? #
When AL Status bit 4 asserts Error Indication, read the AL Status Code register and CoE Error Code 0x603F first, because those two registers separate state-sequence mistakes, PDO sizing mismatches, and cyclic watchdog drops immediately.
- State, mailbox, or revision rejection: Read the AL Status Code register via an EtherCAT read datagram (FPRD), fix the fault, and acknowledge on the rising edge of AL Control bit 4 (per ETG.1000.6, Beckhoff, Texas Instruments, and Bosch Rexroth documentation). Key codes are
0x0011(skipped state),0x0012(unknown state),0x0016(bad Pre-OP mailbox, reporting combined AL Status0x0012), and0x0003,0x0004, or0x0006(configuration, revision, or SII EEPROM mismatch). - Sync Manager, PDO, or DC rejection: On PRE-OP to SAFE-OP failures,
0x0017and0x001Cflag Sync Manager configuration or type errors,0x001Dand0x001Eflag output or input length mismatches, and0x0024(per IntervalZero and ETG diagnostics) flags unsupported TxPDO mappings or oversize buffers. Codes0x002D,0x0030,0x0032, and0x0036identify Distributed Clocks sync, calibration, or shift-time faults. - Drops from OP to SAFE-OP: Check loop jitter and cabling. Code
0x001Bconfirms Sync Manager watchdog timeout,0x001Aconfirms a synchronization error or RxPDO Toggle Failed Counter trip, and0x002Cconfirms fatal SYNC0/SYNC1 loss from frame loss or CRC errors. - Drive alarms and NI master errors: On Panasonic MINAS-A5B (Doc ID SX-DSV02473), communication alarms include
Err81.1(mailbox),Err81.4(OP PDO watchdog),Err81.5(DC),Err81.6(Sync Manager event mode),Err81.7(SyncManager 2/3, mapped to0xA000in0x603F),Err85.0andErr85.1(TxPDO/RxPDO assignment, mapped to0xFF55),Err85.2(lost link), andErr85.3(SII EEPROM), while drive alarms likeErr12.0over-voltage map as0xFF0C; resolve the master cause with the motor safely stopped and clear via EtherCAT or PANATERM. On NI controllers,-2147138467(0x8005445D) and-2147138468(0x8005445C) flag ESI, Sync Manager, or DC aborts, and-2147138473(0x80054457) flags an internal stack error.
What step-by-step commissioning sequence verifies EtherCAT position control? #
Verify the entire control chain in eight ordered checks, from physical IN-port link through sustained OP cyclic stability and ramped low-speed increments, so each layer is proven before you energize the servo power stage.
- Confirm link LEDs on the master port and drive
INconnector, scan the bus, and verify the loaded ESI revision matches the drive firmware. - Step
INITtoPRE-OPand confirm AL Status reports Pre-Operational with bit 4 clear and AL Status Code equal to zero. - Configure or verify Sync Manager PDO assignments and mode of operation over SDO in
PRE-OPwith zero SDO abort codes. - Step
PRE-OPtoSAFE-OP, verify live Statusword and Position actual value updates, and begin transmitting valid RxPDO frames. - Step
SAFE-OPtoOPand run your timed loop for several minutes with the power stage disabled, verifying zero missed cycles and no fallback toSAFE-OP. - Confirm Modes of operation display echoes
8(CSP) or1(Profile Position). - Walk Controlword through Shutdown and Switch On, copy Position actual value to Target position, write Enable Operation, and confirm Statusword masks to
0x0027with no shaft jump. - Command a ramped low-speed test move on an uncoupled shaft and confirm actual position tracks target position with bounded following error.
Match the final architecture to the motion job. Choose Profile Position mode for single-axis indexing without a motion library, choose CSP mode with a deterministic master ramp for continuous single-axis paths, and adopt a dedicated motion library or motion controller whenever your machine requires coordinated multi-axis interpolation or electronic camming.
Questions asked
Can you inspect an EtherCAT servo drive when the vendor ESI file is unavailable?
Recent NI-Industrial Communications for EtherCAT releases from 2025 Q4 through 2026 Q4 added Online Object Dictionary Discovery and modular device fallback with ESI revision parsing, which lets you inspect SDO entries without a local XML file. For production servo control, however, still obtain the exact revision-matched ESI from the drive manufacturer because it specifies fixed Sync Manager addresses, default PDO layouts, and Distributed Clocks timing parameters that discovery alone does not guarantee.
When does an EtherCAT master use the Bootstrap state instead of PRE-OP?
The Bootstrap state (code 0x03 in AL Control) exists solely for firmware updates over File over EtherCAT and is never part of normal servo startup. Requesting Bootstrap on a drive that lacks firmware-download support returns AL Status Code 0x0013, while missing valid firmware reports 0x0014 and bad Bootstrap mailbox settings report 0x0015. Never request Bootstrap directly from Operational state because the EtherCAT State Machine rejects that jump as an invalid state change.
What does AL Status bit 5 do on multi-axis EtherCAT servo topologies?
Bit 5 of the AL Status register carries the Device Identification flag rather than an error state. On multi-drive machines where daisy-chained cables could be swapped during service, explicit station aliases and hardware ID switches let the master verify each axis by identity instead of relying purely on physical cabling order. Keep bit 5 masked separately from bits 3 to 0 for state decoding and bit 4 for Error Indication.
Should you enable Distributed Clocks before testing single-axis EtherCAT position moves?
Start single-axis commissioning in SM-Synchron or Free Run mode if your servo drive manual permits it, because disabling Distributed Clocks temporarily isolates PDO mapping and CiA 402 enable faults from clock-calibration errors. Once cyclic position tracking works cleanly, enable Distributed Clocks with the exact cycle time and shift time listed in the drive documentation. Multi-axis interpolation and drives that strictly require SYNC0 interrupts for Cyclic Synchronous Position mode need Distributed Clocks active before entering Operational state.
How do you shut down a live EtherCAT servo axis without tripping a watchdog alarm?
Bring commanded velocity to zero while holding Operational state, then send Disable Voltage or Shutdown in the controlword until the statusword confirms the power stage is off and any mechanical holding brake has engaged. Continue transmitting cyclic process data frames throughout that disablement window so the Sync Manager watchdog never expires mid-stop. Only after the drive reports a disabled state should your master step down from Operational to Safe-Operational or Pre-Operational and halt the cyclic loop.

