Download the installer (Windows x64, master driver included) · Website & docs · 中文 — nine runnable, real-hardware examples for the Darra EtherCAT Master SDK.
Every project here scans a real bus, brings CiA 402 drives to OP and exchanges cyclic PDO data. No simulator, no stub layer, no sample that only prints a number.
| The usual problem | What this gives you |
|---|---|
| You have to write an EtherCAT master and a kernel driver before the first motor turns | One installer: runtime, kernel-mode real-time driver, GUI and SDK. Install it and the bus is yours |
| Every language binding is a different API with different semantics | Six SDKs — C, C++, C#, Java, Python, Rust — over one C core. Same calls, same state machine, same diagnostics |
| Sample code that only works in the author's lab | Nine projects with real PDO maps, CiA 402 state machines, calibration notes and alarm handling, each with its own README |
WKC is 0 and no idea which slave is the problem |
Per-slave AL status with reason code, link/port state, WKC, DC sync, graded alarms |
- Install. Run Darra-EtherCAT-Setup.exe on Windows x64. It installs the runtime, the driver and the GUI. Reboot if it asks.
- Give the master a dedicated NIC. In the Darra GUI, bind the master protocol to the network adapter that goes to your drives — never your office/Internet adapter. Turn off RSS, interrupt moderation and energy saving on that adapter.
- Scan and export. Scan the bus in the GUI. Slaves appear in daisy-chain order. Export
config.deni— it captures the NIC, the slave topology and the exact PDO/FMMU startup commands. It is not hand-editable. - Build an example. Open
Windows/CSharp/Ezi-SERVO2_CSP_PP/Ezi-SERVO2 Test.csprojin Visual Studio 2022 (platform x64). NuGet restoresDarra.EtherCAT.Master(if restore cannot find the pinned version, see Known limitations);VMProtectSDK64.dllis copied byDirectory.Build.targetsfrom the copy tracked in this repo. - Run as Administrator (raw Ethernet frames need elevation), drop your
.deniwhere the example's README says, then Connect → Enable → move.
The bus is real. Nothing moves until you explicitly enable a drive, target positions start at the current actual position, and jog is dead-man — release the button and the axis stops.
All nine are C# / .NET Framework 4.7.2 / Windows x64 WinForms projects; FurutaPendulum and RobotToolChanger also run headless as a CLI, sharing one control layer with their UI.
| Example | Hardware | What it demonstrates | Difficulty |
|---|---|---|---|
| Ezi-SERVO2_CSP_PP | Ezi-SERVO2 servo (FASTECH) | Single axis, CiA 402: state machine, jog, absolute / relative positioning, homing | Starter |
| HCFA_X3E_QuarterTurn | HCFA X3E (reference drive) | Canonical servo bring-up: Connect (SafeOp) → Enable (06→07→0F → OP) → 250 ms quarter turn at 500 µs |
Starter* |
| STF-EC_CSP_PP | STF-EC stepper (MOONS') | Multi-axis CSP + PP; the UI sizes itself from the scanned slave count | Intermediate |
| STF-EC_SyncAxis | STF-EC stepper (MOONS') | Electronic gear: virtual master + per-axis ratio, 1:1 lockstep | Intermediate |
| STF-EC_ECam | STF-EC stepper (MOONS') | Electronic cam: sine / cycloid / linear curves + per-axis phase offset, group-stop alarms | Advanced |
| Panasonic_CNC_Interpolation | Panasonic MINAS A6B | G01 line and G02/G03 arc interpolation, trapezoidal / S-curve accel, look-ahead, 2D path preview | Advanced |
| Panasonic_ConveyorSync | Panasonic MINAS A6B | Master-slave conveyor sync, Touch-Probe material tracking, flying pick | Advanced |
| FurutaPendulum | GCAN-8200 MDP coupler + GC1602 counter + CiA 402 stepper | Rotary inverted pendulum: energy swing-up → cascade-PID balance at 500 µs, closed on an encoder that shares the bus with the axis | Advanced |
| RobotToolChanger | 6-axis CiA 402 arm + pluggable tool modules | Per-module identity check (VID/PID/REV/SN + CoE 0x1018), module loss or WKC deficit latches the safety interlock |
Advanced |
* HCFA_X3E_QuarterTurn is the in-repo DEV/SOURCE sample: it builds with ProjectReference against the SDK source tree and needs /p:DarraCoreManifest=..., so it does not build from a clean clone. See Known limitations.
Motion modes covered: CSP (target position every bus cycle), PP (drive-generated profile), electronic cam, electronic gear, multi-axis interpolation, and master-slave material tracking. Each example's README explains the PDO layout, the SDK calls it uses and how to calibrate it.
| Category | Supported |
|---|---|
| Mailbox | CoE (SDO), FoE (firmware update), EoE (Ethernet tunnel), SoE, AoE, VoE |
| Application profiles | CiA 402 (servo / stepper), CiA 401 (digital and analog I/O), MDP (modular devices) |
| Safety | FSoE (Safety over EtherCAT) |
| Cyclic | PDO with direct struct mapping, DC distributed clock (Sync0 / Sync1) |
| Category | Supported |
|---|---|
| Topology | Line, ring with Mode 2 dual-NIC cable redundancy, hot-plug detection and automatic recovery |
| State control | Init / PreOp / SafeOp / OP with full transition control and rollback on failure |
| Configuration | ENI / DENI import and export, ESI management, automatic startup-SDO download |
| Diagnostics | Per-slave AL status with reason code, link and port state, WKC, DC sync, severity-graded alarms |
One C core, six bindings, the same API semantics in each.
| Language | Minimum version | Entry point |
|---|---|---|
| C | C99 | ethercat.h function API |
| C++ | C++17 | RAII class wrappers |
| C# | .NET Framework 4.7.2 / .NET 6+ | DarraEtherCAT class |
| Java | JDK 11+ | EtherCATMaster class (JNA) |
| Python | 3.8+ | EtherCATMaster class (ctypes) |
| Rust | 1.70+ | EtherCATMaster struct (FFI) |
The C# package is on NuGet as Darra.EtherCAT.Master.
The bus scans, but no slave shows up. Frame left the port and did not come back the same way — that means the link is up. The problem is almost always on the receive side: the master protocol is not actually bound to that NIC, or the adapter is dropping non-IP frames. Check the binding in the GUI, disable RSS / interrupt moderation / energy saving on the adapter, and use a dedicated NIC rather than a USB or shared one.
A slave stays in SafeOp or never reaches OP. Read its AL status code instead of guessing. The master reports the per-slave reason; the usual causes are a PDO mapping mismatch against the ESI, a missing startup SDO, or a DC setting that does not match the drive.
Cyclic WKC stays 0. Check the cycle time before anything else. Some drives — the HCFA X3E in these examples is one — do not answer at 1 ms and need 500 µs. Also confirm the working counter expectation matches the configured PDOs.
"Access denied" or the NIC cannot be opened. Run the example as Administrator, and make sure no other process (another master, Wireshark in capture mode) holds the adapter.
Do I need a specific brand of NIC? No, but it must be a real PCIe/USB Ethernet controller that the Darra driver supports, and it must be dedicated to EtherCAT. Do not share it with Windows networking.
Windows/CSharp/
├── Directory.Build.targets # shared build contract (copies the VMProtect runtime)
├── 第三方运行库/ # VMProtect runtime required by Darra.Core.dll
├── HCFA_X3E_QuarterTurn/ # reference drive bring-up, 500 µs
├── Ezi-SERVO2_CSP_PP/ # single-axis servo, CSP + PP
├── STF-EC_CSP_PP/ # multi-axis stepper, CSP + PP
├── STF-EC_ECam/ # multi-axis electronic cam
├── STF-EC_SyncAxis/ # multi-axis electronic gear
├── Panasonic_CNC_Interpolation/ # multi-axis CNC interpolation
├── Panasonic_ConveyorSync/ # conveyor master-slave + material tracking
├── FurutaPendulum/ # inverted pendulum: MDP counter + CSP stepper
└── RobotToolChanger/ # 6-axis tool changer with latched interlock
COMMISSIONING.md covers the parts that are the same for every example: wiring, driver install, drive configuration, exporting config.deni, and calibration (pulses per unit, soft limits, gear ratio, pick zone).
- The pinned NuGet version is newer than the public feed. The projects reference
Darra.EtherCAT.Master2.13.14 / 2.13.16, while nuget.org currently publishes up to 2.13.2. Until the newer package is published, either lower thePackageReferenceversion to one that exists on nuget.org, or point NuGet at the SDK's local package folder. Restore reportsNU1101otherwise. - Windows x64 only for now. The Linux runtime is in development and not released.
HCFA_X3E_QuarterTurndoes not build from a clean clone. It is kept as the reference for the default drive but references the SDK source tree viaProjectReferenceand requires/p:DarraCoreManifest=.... Start from one of the NuGet-based examples instead.- Example-level READMEs are written in Chinese. This file and
COMMISSIONING.mdare English/Chinese. - Some examples ship a lab-rig
config.deni. It encodes our rig's NIC, MAC and slave order and will not work on your machine — always export your own from the GUI. bin/folders contain Debug output from an older SDK build. They are kept from an earlier release; rebuild from source rather than running them.
- Download (Windows x64, driver included): https://download.darra.xyz/ethercat/client/Darra-EtherCAT-Setup.exe
- Website and documentation: https://ethercat.darra.xyz/
- C# SDK on NuGet: https://www.nuget.org/packages/Darra.EtherCAT.Master
- Commissioning guide: COMMISSIONING.md
These examples are reference code for the Darra EtherCAT Master SDK. They do not replace a hard-wired emergency stop, STO, or the commissioning procedure your drive vendor requires.