Configuring EtherCAT Servo Control: External Task Setup Guide

James Nishida16 min read
Motion ControlOmronTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview: EtherCAT Servo Control on Embedded WinCE Controllers

EtherCAT (Ethernet for Control Automation Technology), developed by Beckhoff Automation, is the dominant real-time fieldbus for high-performance servo motion in modern machinery. The protocol achieves cycle times as low as 100 µs with sub-microsecond distributed-clock jitter by using a "processing-on-the-fly" frame architecture: each slave reads its data from the passing Ethernet frame and inserts its output data in the same frame before forwarding it downstream. This makes EtherCAT ideal for multi-axis servo synchronization, but it places strict real-time demands on the master's network stack and task scheduling.

On full Windows or Linux masters, the EtherCAT master stack (TwinCAT, SOEM, IgH EtherLab, acontis EC-Master, CODESYS EtherCAT) can typically be bound to a high-priority real-time thread or kernel module that polls the Ethernet MAC at deterministic intervals. On Windows Embedded Compact (WinCE) platforms such as those used by Kuhnke / Kendrion (now Kendrion) VICO controllers, the situation is different. WinCE offers real-time capabilities, but the default scheduler and stack are not always configured to drive the EtherCAT master at the required deterministic rate. The standard remedy, confirmed in the field by the field report, is to set up an external triggered task that wakes the EtherCAT master at a fixed period driven by a hardware timer or the distributed-clock interrupt, decoupled from the WinCE CE scheduler's default tick.

This article provides the full engineering reference for that fix and the surrounding architecture: distributed clocks, PDO mapping, drive selection (Omron 1S / Accurax G5, Beckhoff AX5000, Kollmorgen AKD2G), cycle-time budgeting, FCL (Fast Current Loop) integration per TI's SPRACM9 application report, and a troubleshooting matrix for the typical faults that surface when the external task is misconfigured.

Safety note. Servo systems store mechanical energy and can execute uncontrolled motion if the EtherCAT state machine is mishandled. Always configure the Safe-Op state, STO (Safe Torque Off) per IEC 61800-5-2, and the emergency-stop chain before any live commissioning.

EtherCAT Fundamentals for Servo Motion

Every EtherCAT network has a single master and one or more slaves. The master transmits an Ethernet frame (typically a broadcast) that passes through every slave in sequence. Each slave:

  1. Reads its assigned input data from the frame as it passes through.
  2. Inserts its output data into the same frame at the slave's configured offset.
  3. Forwards the modified frame to the next slave.

The frame returns to the master, which evaluates the response and starts the next cycle. With a 100 Mbit/s link and a typical 30-byte-per-slave payload, networks of 50+ slaves can be updated in well under 500 µs.

EtherCAT State Machine

Each slave progresses through four states during commissioning:

State Description Permitted operations
Init No mailbox, no process data. Master reads EEPROM / ESI, assigns station address.
Pre-Op Mailbox active, no process data. SDO / CoE configuration, PDO mapping via CoE object 0x1C00.
Safe-Op Inputs valid, outputs held in safe state. Read PDO inputs; outputs disabled; DC sync active.
Op Full cyclic data exchange. Drive enabled, PDO inputs and outputs updated every cycle.

Distributed Clocks (DC)

For multi-axis synchronization, the first DC-capable slave becomes the reference clock. The master measures the propagation delay to each slave with the FRMW and DC Read / Write datagrams, then issues DC SYNC0 / SYNC1 pulses that fire at precise phase offsets. Achievable jitter is sub-microsecond. Servo drives latch their cyclic position / velocity sampling on SYNC0 and exchange process data on the next cycle. Misconfiguring the DC cycle time is one of the most common sources of "servo runs but oscillates" or "Sync Unit cycle time mismatch" errors.

WinCE and Real-Time Constraints

Windows Embedded Compact (WinCE 6.0, 7.0, Compact 2013) is a real-time capable OS — the kernel supports priority inheritance and 1 ms system tick granularity by default, with some BSPs offering 250 µs tick rates. However, the EtherCAT master stack's cycle period is not the same as the OS tick. The master must be invoked on a deterministic, jitter-bounded thread, with the following requirements:

  • The thread priority must be above all non-realtime threads and below any interrupt service routine.
  • The thread should be locked to a single core and have its stack pinned.
  • Critical sections that block on the master thread (SDO accesses, log writes, file I/O) must be offloaded to a lower-priority worker.
  • On WinCE specifically, GWES, NK, and the filesystem subsystems can preempt low-priority threads. A purely software-tick-triggered task will see jitter from 100 µs to several milliseconds under load.

For these reasons, the standard EtherCAT master configuration on WinCE-based industrial controllers is the external triggered task model, where the cycle is driven by a hardware timer interrupt (often the same interrupt that latches the distributed-clock timestamp) and the user PLC task is slaved to the EtherCAT master rather than the reverse.

External Triggered Task Architecture

The external triggered task model inverts the usual PLC cycle model. Instead of "the PLC runs every 1 ms, and EtherCAT is updated at the end," the model is:

  1. A hardware timer (the Beckhoff ESC SYNC0 / Latch0, or a dedicated FPGA / SoC timer) generates an interrupt at the desired cycle period (250 µs, 500 µs, 1 ms, 2 ms, 4 ms).
  2. The interrupt handler signals the EtherCAT master task.
  3. The EtherCAT master exchanges one cycle of process data with all slaves, including servo drives.
  4. At the end of the cycle, the master posts a "cycle finished" event to the PLC runtime (CODESYS, TwinCAT, KPA, etc.).
  5. The PLC runtime reads the new input image, runs one cycle of user code, and writes the new output image, which will be sent on the next EtherCAT cycle.

This introduces a one-cycle latency between PLC and drive, but guarantees deterministic EtherCAT timing regardless of PLC code length or other OS activity. The CODESYS EtherCAT configurator calls this the "External" or "External synchronization" task mode; TwinCAT calls it "Sync Unit 2 triggered by SYNC0" mode when the second sync unit is the PLC.

Latency budget. On a 1 ms cycle, the PLC has up to 1 ms to complete. On a 250 µs cycle, the budget collapses to 250 µs. Keep the cyclic PLC code under 50% of the cycle time. Anything slower and you begin losing frames, which surfaces as "Working Counter" errors and the master dropping the slave to Safe-Op.

Configuring External Tasks on CODESYS / TwinCAT / KPA EtherCAT

CODESYS EtherCAT (used by Kendrion VICO, Festo CPX, Bosch Rexroth IndraLogic, Schneider M241 / M251)

In the CODESYS EtherCAT task configuration dialog, set the following parameters:

Parameter Recommended value Notes
Task type External Cycle is driven by external event, not internal timer.
External event source EtherCAT cycle finished Selects the master task event.
Cycle time (display only) Match DC cycle: 250 µs / 500 µs / 1 ms / 2 ms / 4 ms Must match the SYNC0 period set on the reference slave.
Priority Highest available, typically 30–39 on WinCE Higher than any user task; lower than ISRs.
Watchdog time 2 × cycle time (default), 3 × for tolerance Trips if cycle exceeds the limit, dropping drives to Safe-Op.
Synchronization DC SYNC0, Latch on rising edge Matches the first DC-capable slave (typically the first servo drive or an EK1100 / EK1122 coupler).

TwinCAT 3

In the TwinCAT I/O configuration, add a new Sync Unit for the EtherCAT task and bind the SYNC0 task to the DC reference clock. Right-click the EtherCAT task → "Auto Calculate" to align the PLC task. On the CX series embedded controllers (CX5130, CX5140, CX8190 running WinCE / WEC 2013), the TwinCAT real-time is driven by the Beckhoff NC PTP driver and the SYNC0 from the EK1100 / EK1110 EtherCAT coupler.

acontis EC-Master / KPA EtherCAT Master

Both masters expose a SetCycleTime() and a callback pNotify() invoked from interrupt context when the cycle is due. The application must post a WinCE event in the callback, then the cyclic thread waits on that event. Do not call ProcessAllSlaves() directly from the ISR — it can take 50–200 µs and starve higher-priority interrupts.

PDO Mapping and Drive Integration

For a typical servo axis, the cyclic process data consists of RxPDO (master → drive) and TxPDO (drive → master) telegram slots. For Omron 1S and Accurax G5 drives per the Omron EtherCAT Servo Motors and Drives product family, the standard CiA 402 mapping is:

PDO Index 0x16xx / 0x1Axx Size Content
RxPDO 1 (0x1600) 0x6040 Controlword, 0x60FF Target Velocity (PV), 0x607A Target Position (PP) 2 / 4 / 4 bytes Master commands
TxPDO 1 (0x1A00) 0x6041 Statusword, 0x6064 Position Actual Value, 0x60FB Position Following Error 2 / 4 / 4 bytes Drive feedback
RxPDO 2 (0x1601, optional) 0x60B0 Position Offset, 0x60B2 Torque Offset 4 / 2 bytes Touch probe / supplementary
TxPDO 2 (0x1A01, optional) 0x6061 Modes of Operation Display, 0x60FD Digital Inputs 1 / 4 bytes Status / I/O

The total telegram for one 1S axis is typically 22–28 bytes in CSP (Cyclic Synchronous Position) mode. With 8 axes, a full machine telegram is ~200 bytes — comfortably under the 1486-byte maximum of a single EtherCAT frame, leaving room for I/O terminals and safety modules.

Mode of Operation (object 0x6060)

Mode Code (decimal) Use case
Profile Position (PP) 1 Point-to-point moves with on-board trajectory generator.
Profile Velocity (PV) 3 Velocity control, no position loop in drive.
Profile Torque (PT) 4 Force / tension control.
Cyclic Synchronous Position (CSP) 8 Position loop closed in PLC, drive is current / velocity inner loop only. Required for high-precision registration and electronic gearing.
Cyclic Synchronous Velocity (CSV) 9 Velocity loop in drive, PLC feeds velocity setpoint each cycle.
Cyclic Synchronous Torque (CST) 10 Torque loop in drive, PLC feeds torque setpoint each cycle.

Distributed Clocks and Synchronization

DC is the only way to keep multiple axes phase-locked. Configuration sequence:

  1. Identify the first DC-capable slave (the master scans ESC register 0x0910 DC receiver mode).
  2. Set SYNC0 Cycle Time to the desired EtherCAT period (250 µs / 500 µs / 1 ms / 2 ms / 4 ms).
  3. Set SYNC0 Shift Time to 0 for the reference slave, then run CalcPropagationDelays for all DC slaves.
  4. For each servo drive, set 0x1C32.02 SYNC0 Cycle Time and 0x1C32.06 SYNC0 Shift Time to match the master config.
  5. Enable the drive's 0x60C2 Interpolation Time Period to the same value.

Common error: "DC PLL not in sync" (ESC register 0x0930 bit 0). Caused by mismatch between the master's reported cycle time and the SYNC0 pulse period, or by a non-DC slave sitting between two DC slaves and breaking the chain. All slaves in a sync domain must be DC-capable; EK1100 couplers with the latest ET1100 ESC (revision ≥ 1.6) are DC-capable, but older EK1000 couplers are not.

Cycle Time and Jitter Budget

For a typical packaging machine with 4 servo axes and 32 I/O points, the cycle-time budget at 1 ms DC is:

Step Time
EtherCAT frame send + return (100 Mbit/s, full duplex) 40–60 µs
Each slave processing latency (8 slaves) ~ 1 µs each = 8 µs
Drive internal current loop (FCL on TI C2000) 33 µs (30 kHz)
PLC scan (CODESYS ladder, 4 axes of motion FB) 200–400 µs
Image copy, scheduling overhead 50–100 µs
Total deterministic time 300–600 µs of 1000 µs

Remaining headroom is for SDO accesses, HMI updates, and background work. If you see cycle-time overruns, the first lever is to reduce the number of cyclic axes, the second is to move from PP / PV to CSP and let the drive handle the inner loops, the third is to upgrade the controller (CX5140 with TwinCAT outperforms a WinCE CX5020 by 3–5×).

Fast Current Loop (FCL) — TI EtherCAT Reference

For servo drives based on the TI C2000 family (TMS320F28388D, TMS320F28379D) with the ET1100 EtherCAT slave controller, TI's SPRACM9 application report on EtherCAT-based FCL servo control describes a Fast Current Loop that closes the current loop entirely inside the MCU, bypassing the slower FOC library in the main CPU. The result:

  • Current loop update: 30 kHz (33 µs period), one cycle of the PWM carrier.
  • Velocity loop: 8 kHz (125 µs), decimated from the current loop.
  • Position loop: 4 kHz (250 µs) in CSP, fed by the EtherCAT cycle.

To use FCL, the EtherCAT cycle (DC SYNC0) must be an integer multiple of the PWM period. For a 250 µs EtherCAT cycle and 33 µs current loop, the drive runs 7–8 current loops per EtherCAT cycle — the ratio must be an exact integer or the DC PLL will drift and the master will log "DC sync lost" within seconds.

PWM-EtherCAT alignment. Set PWM_TBPRD = 33 µs and DC SYNC0 = 264 µs (8 × 33 µs) for an exact 8:1 ratio. Do not pick cycle times that share only a small common multiple — they will compile and run, but DC jitter will be visible on a scope and eventually cause a Working Counter error.

Troubleshooting Matrix

Symptom Probable cause Diagnostic step Resolution
Slaves stuck in Init; AL Status = 0x001E (no valid firmware) ESI file mismatch or firmware corruption on slave Compare slave revision in ESI vs. online; check 0x1018.01 Vendor Update ESI from manufacturer site or reflash slave firmware via FoE
Slaves reach Pre-Op, then Working Counter error PLC cycle not aligned to EtherCAT cycle; master sending at OS tick rate Enable cycle-time histogram in master; check jitter > 100 µs Switch task to external triggered mode; align PLC to EtherCAT event
Drive reaches Op but oscillates or trips F0FF on Omron DC SYNC0 misconfigured or non-DC slave breaking chain Read ESC register 0x0930 DC status; check 0x1C32.06 SYNC0 Shift Time Recompute propagation delays; replace non-DC EK1000 with EK1100; set explicit SYNC0 shift per drive
Random Lost Link on one axis only EMI on cable between M12 connectors, or shield not terminated at both ends Check cable shielding, scan for noise sources on VFD output cables Use CAT5e + braid shield; terminate shield 360° at connector backshell
Master CPU at 90%+, cycle times double EtherCAT master driven by same thread as logging / HMI Profile thread CPU; check for SDO blocking on cyclic thread Move all SDO accesses to background task; bind cyclic thread to a single core
Omron 1S reports E80.1 or E80.2 on startup Initial PDO mapping not loaded into drive NV-RAM Check 0x1C00 / 0x1A00 / 0x1600 in CoE object dictionary Reload default PDO mapping from manufacturer EDS / ESI; do a Factory Reset of the drive (Omron parameter Pn050 = 0x1234)
WinCE controller blue-screens on first EtherCAT cycle Stack pointer overflow in EtherCAT task; default stack 16 KB too small for ESI parser Set cyclic thread stack to 64 KB; check GWES heap Increase stack size in CODESYS task config; reduce number of slaves for test
Working Counter matches but drives do not follow Target Position Mode of Operation (0x6060) = 0 (no mode) or PP instead of CSP Read 0x6061 Modes of Operation Display; check Controlword state machine transitions Write 8 to 0x6060 for CSP; complete Controlword sequence 0x06 → 0x07 → 0x0F

Commissioning and Verification

  1. Wire the network: master → EK1100 (DC reference) → drive 1 → drive 2 → … → final drive → EK1100 second port or cable back to master. Verify both ports of the EK1100 are in use and the ring is closed or the terminator is on the last slave.
  2. Import ESI files for every slave (Omron 1S ESI, Beckhoff EK1100 ESI, etc.). ESI files are XML and must match the slave hardware revision exactly.
  3. Run the master's Scan / Browse function. The slave list should populate with the correct order, vendor, and product code.
  4. Configure the master cycle: 1 ms typical for first bring-up; drop to 500 µs or 250 µs once motion is verified.
  5. Set the DC reference slave to "SYNC0 master" mode and set the cycle time. Compute propagation delays.
  6. Transition slaves to Pre-Op, configure PDO mapping (CoE object 0x1C00 subindices), then Safe-Op and Op.
  7. Verify the Statusword (0x6041) bit 0 (Ready to switch on), bit 1 (Switched on), bit 2 (Operation enabled) are set after the Controlword (0x6040) state-machine transitions 0x06 → 0x07 → 0x0F.
  8. Issue a slow jog command (Target Velocity = 1000 rpm, then clear) and verify feedback on the TxPDO. Check that the Working Counter in the master diagnostic equals the expected number of slaves × 1 (or × 2 in some profiles).
  9. Run a 10-minute soak test with the drive loaded to 30% rated torque, then 100% for 1 minute, monitoring cycle time, jitter, and master CPU.
  10. Record the final configuration (cycle time, jitter histogram, CPU profile) as the machine's golden reference for future maintenance.

Performance Optimization and Field Notes

Three rules from the field:

  1. If you are using WinCE, do not try to drive the EtherCAT master from the default PLC task. The OS tick granularity and the GWES thread are not your friends. Always use the external triggered task model. This is the root cause behind the field report's "we solved it by using external task" finding.
  2. Always set the master cycle time to an exact multiple of the drive's current-loop period. If you are using a TI C2000 with FCL per the SPRACM9 reference, you must coordinate the two. For other vendors (Omron, Kollmorgen, Beckhoff), check the drive's Interpolation Time Period parameter (CiA 402 object 0x60C2) and the drive manual's "EtherCAT communication period" specification as listed on the Omron EtherCAT servo family page.
  3. Keep cyclic PDOs small. If a single TxPDO exceeds 32 bytes, it is almost always a sign that the configuration is wrong — typically the wrong subindex selected, or the drive set to "all-objects" mapping rather than the optimized vendor mapping. Re-import the ESI and use the vendor default PDO set.
Documentation links. For supported cycle times, safety functions, and firmware requirements, see the Omron EtherCAT Servo Motors and Drives product family. For the FCL-EtherCAT interaction model and frequency response analysis, see the TI SPRACM9 application report.

FAQ

Why does EtherCAT control on WinCE need an external triggered task?

WinCE's default OS tick is 1 ms and is preempted by GWES, NK, and the filesystem. Driving the EtherCAT master from the default PLC task introduces 100 µs to several milliseconds of jitter. The external triggered task model — where a hardware timer or DC SYNC0 interrupt wakes the master — decouples the EtherCAT cycle from the OS scheduler and keeps jitter below 5 µs.

What is the minimum EtherCAT cycle time on a typical WinCE controller?

Most WinCE-based industrial controllers (Kendrion VICO, Beckhoff CX50xx, Festo CPX-CEC) can reliably run 1 ms and 500 µs cycles. 250 µs is achievable on hardware with a high-precision timer (e.g., Beckhoff CX5140) but borderline on older CX5020 / CX1020. Below 250 µs, you should move to TwinCAT on Windows or a Linux/RT controller.

How do I set the Omron 1S drive to CSP mode over EtherCAT?

Write 8 to object 0x6060 (Modes of Operation), confirm in 0x6061 (Modes of Operation Display), then map the RxPDO to include 0x607A (Target Position). The drive's position loop becomes 0 and the master must update Target Position every EtherCAT cycle. Set 0x60C2.01 (Interpolation Time Period value) to the EtherCAT cycle time in 0x60C2.02 — typically -6 for 1 ms, -9 for 250 µs, where units are 10^(value) seconds.

What is the difference between SYNC0 and SYNC1 in DC mode?

SYNC0 is the primary cycle pulse that triggers PDO input latching on each drive. SYNC1 is an optional secondary pulse, typically used to offset the start of the drive's internal FOC computation from the PDO latch by a few hundred nanoseconds to allow settling time. Most servo drives only need SYNC0; SYNC1 is required for high-end drives with sub-microsecond deterministic sampling (e.g., Beckhoff AX5000, Kollmorgen AKD2G with safety option).

Can I run EtherCAT at 4 ms cycle with a software PLC scan that takes 8 ms?

No. The PLC scan must complete within one cycle, or the master will log a Working Counter error and drop the slaves to Safe-Op. Either reduce the PLC scan (use 32-bit operations, move HMI tags to a slower task, disable unused libraries) or increase the EtherCAT cycle to 10–20 ms. The external triggered task model exposes this issue immediately, which is part of why it is the recommended WinCE configuration.

Back to blog