EtherCAT 主站协议栈 Python SDK · 全协议 (CoE/SoE/FoE/EoE/AoE/VoE/FSoE) + CiA 402/401 · DC 同步 · 电缆冗余 + 热插拔 · 复杂拓扑 · 配 DarraRT 实时内核驱动达微秒级帧时序 · Windows/Linux · EtherCAT master protocol stack for Python: full mailbox protocols, CiA 402/401, distributed clocks, cable redundancy, hot-plug, complex topology; microsecond frame timing with the DarraRT real-time driver.
Project description
Darra EtherCAT Master · Python SDK
EtherCAT 主站协议栈的 Python SDK:全部 7 种邮箱协议 + CiA 402/401 驱动配置 + DC 分布式时钟 + 电缆冗余 + 复杂拓扑,配 DarraRT 实时内核驱动可达微秒级帧时序。6 种语言 SDK 行为字节级一致。
Python SDK for the Darra EtherCAT master stack — all 7 mailbox protocols, CiA 402/401, distributed clocks, cable redundancy and complex topologies; microsecond-level frame timing with the DarraRT real-time driver.
性能 · Performance
帧发送周期抖动实测(配 DarraRT 实时内核驱动):
| 平台 / Platform | 建议周期 / Cycle | 帧抖动(平均) / Jitter | 最大抖动 / Max |
|---|---|---|---|
| Windows 10 IoT (SMI 抑制) | 62.5 µs | 1.0 µs | 4.2 µs |
| Linux PREEMPT_RT | 62.5 µs | 0.7 µs | 3.2 µs |
| FreeRTOS | 31.25 µs | 0.3 µs | 2 µs |
- 最小周期 31.25 µs · DC 同步 ≤ 1 µs · 零拷贝 PDO 映射
- DENI 文件加载比从零扫描快约 50%(实测 7.4 s vs 15.2 s)
微秒级实时由 SDK + DarraRT 实时内核驱动 + 兼容硬件共同提供。SMI/SMM 属硬件层中断,完全抑制需 BIOS/UEFI 配合。 Microsecond timing is delivered by the SDK together with the DarraRT real-time driver and supported hardware; full SMI suppression requires BIOS/UEFI tuning.
能力 · Capabilities
- 全邮箱协议 — CoE (SDO/PDO/EMCY/CiA402) · SoE · FoE · EoE · AoE · VoE · FSoE(功能安全 SIL3)
- 驱动配置 — CiA 402 全模式 (CSP/CSV/CST/PP/PV/HM) + CiA 401 数字/模拟 I/O
- 可靠性 — 电缆冗余零丢帧切换 · 三级故障自愈(不停 PDO 循环)· 运行中热插拔
- 复杂拓扑 — 线 / 星 (EK1122) / 树 (EK1100) / 环 / 混合
- 在线诊断 — 从站状态 / AL Status Code / PDO 值实时可读 · 周期抖动统计 (ETG.1510)
- 邮箱网关 — ETG.8200,兼容 TwinCAT 等第三方工具
- 6 语言一致 — C / C++ / C# / Java / Python / Rust,枚举 / 错误码 / CRC 字节级一致
安装 · Install
pip install darra-ethercat-master
要求:Python 3.12 · Windows 10/11 x64 · 需安装 DarraRT 实时内核驱动(随安装包,首次以管理员运行)。 Requires Python 3.12, Windows 10/11 x64, and the DarraRT real-time kernel driver (bundled in the installer).
示例 · Example
DENI 一行加载 → 进 OP → PDO / 邮箱读写:
from darra_ethercat import EtherCATMaster, EcState
master = (EtherCATMaster()
.set_eni(r"C:\EtherCAT\MyProject.deni") # 配置工具一键导出的 DENI
.build())
master.set_state(EcState.OP) # 自动 INIT → PreOp → SafeOp → OP
# 过程数据 (PDO):进 OP 后内核每周期自动收发,循环里直接访问最新值
slave = master.slaves[0]
statusword = slave.pdo.read_uint16(0) # 读输入 (TxPDO)
slave.pdo.write_int32(0, 100_000) # 写输出 (RxPDO),下一周期自动发出
# 非周期邮箱 (CoE SDO)
target = slave.coe[0x607A][0x00].get_value() # 类型化读
版本兼容 · Version compatibility
| 升级 / Upgrade | 重装驱动? / Reinstall driver? |
|---|---|
| PATCH (X.Y.1 → X.Y.2) | ❌ pip install --upgrade 即可 |
| MINOR / MAJOR | ✅ 需同步更新配套驱动安装包 |
master.build() 启动时自动校验 SDK 与驱动版本,不匹配写日志 Warning。
更多 · More
- Python SDK 文档 / Docs — https://ethercat.darra.xyz/docs/sdk/python
- 官网 / Homepage — https://ethercat.darra.xyz
- 应用案例 / Examples — https://ethercat.darra.xyz/docs/examples
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file darra_ethercat_master-2.8.0.tar.gz.
File metadata
- Download URL: darra_ethercat_master-2.8.0.tar.gz
- Upload date:
- Size: 354.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51f5cb5b74ba1bb590782fa644a77edd9930145da510fd9ffcc8ba863f738af4
|
|
| MD5 |
1a9ec1deff8f428968feb0ff2de294cd
|
|
| BLAKE2b-256 |
75acc065312a88c5ef800c6766e36211639f8380103776c37e09902fbadea214
|
Provenance
The following attestation bundles were made for darra_ethercat_master-2.8.0.tar.gz:
Publisher:
publish-pypi.yml on jtl1207/Darra_ETH_Publish
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
darra_ethercat_master-2.8.0.tar.gz -
Subject digest:
51f5cb5b74ba1bb590782fa644a77edd9930145da510fd9ffcc8ba863f738af4 - Sigstore transparency entry: 2064159286
- Sigstore integration time:
-
Permalink:
jtl1207/Darra_ETH_Publish@ec65eabef969376722f5bdf3baa5545222f4e4e5 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/jtl1207
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ec65eabef969376722f5bdf3baa5545222f4e4e5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file darra_ethercat_master-2.8.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: darra_ethercat_master-2.8.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 35.0 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce4023cd31a1687633c08fc1f2a563b514134588ec3a9c0b3b5394176d4bceed
|
|
| MD5 |
a34265ea430e3ea61f5f68a74faafb10
|
|
| BLAKE2b-256 |
3bb111d681d8b5e2193103eca406a85d02d18a911aa35ce9df67cba685e84f2d
|
Provenance
The following attestation bundles were made for darra_ethercat_master-2.8.0-cp312-cp312-win_amd64.whl:
Publisher:
publish-pypi.yml on jtl1207/Darra_ETH_Publish
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
darra_ethercat_master-2.8.0-cp312-cp312-win_amd64.whl -
Subject digest:
ce4023cd31a1687633c08fc1f2a563b514134588ec3a9c0b3b5394176d4bceed - Sigstore transparency entry: 2064159306
- Sigstore integration time:
-
Permalink:
jtl1207/Darra_ETH_Publish@ec65eabef969376722f5bdf3baa5545222f4e4e5 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/jtl1207
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ec65eabef969376722f5bdf3baa5545222f4e4e5 -
Trigger Event:
push
-
Statement type: