Device cannot connect or be controlled
Problem description
Some EtherCAT slave devices may show the following problems:
- Cannot reach the OP state (stuck in SafeOp or PreOp)
- Enabling fails
- Parts of the motion control do not respond
The EtherCAT device protocol has a standard, but implementations differ greatly between vendors:
- No ETG conformance certification
- ESI file version too old
- Different state machine timing requirements (some need a delay, some need a specific Controlword sequence)
- Wrong startup parameters (mandatory parameters, default values, write order)
- Different DC synchronization requirements (some require DC, some do not support DC)
- Some vendors have proprietary objects or non-standard behavior
So no single configuration fits every device; the configuration has to be adapted to the documentation of the specific device.
Solution: adapt the device with AI assistance
Collect the device material into one folder, then use an AI tool to analyze it and produce a fix.
Step 1: collect the device material
Create a folder under the project directory and put the following files in it:
device-adaptation/
├── ESI-file.xml # required — slave ESI description file (provided by the vendor)
├── config-file.deni # if available — DENI configuration file currently in use
├── device-manual.pdf/txt # required — device manual (PDF converted to TXT is best)
└── debug.txt # if available — Darra Master debug log output
| File | Source | Notes |
|---|---|---|
| ESI file (.xml) | Vendor website or supplied with the device | PDO mapping, startup parameters, supported modes, and so on |
| DENI configuration (.deni) | Exported from Darra Master | Current master configuration (NIC, startup parameters, and so on) |
| Device manual (.pdf/.txt) | Vendor documentation | Operating sequences, parameter descriptions, example code, and so on |
| Debug log (debug.txt) | Darra Master output | Error codes, reasons for failed state transitions, and so on |
AI tools handle plain text better, so convert the PDF manual to TXT first. Common methods:
- Online tools: search for "PDF to TXT"
- Python:
pdfminer.sixorPyMuPDF - Command line:
pdftotext input.pdf output.txt
An AI tool that can read PDF files directly (such as Claude) can skip this step.
Step 2: analyze with AI
Send the collected files to an AI tool (such as Claude or ChatGPT) together with the following prompt:
English:
Please read https://ethercat.darra.xyz/ai-prompts.txt as prompt context, then help me:
I am having trouble connecting an EtherCAT slave using Darra EtherCAT Master. Please analyze the attached files and provide a fix.
Attachments:
1. ESI file (.xml) — slave device description
2. DENI config (.deni) — current master configuration (if available)
3. Device manual (.pdf/.txt) — vendor operation manual (if available)
4. Debug log (debug.txt) — runtime error output (if available)
Please check the following items against the device manual and provide specific fix steps:
1. PDO Mapping
- Are the RxPDO/TxPDO indexes, sub-indexes, data types, and sizes consistent with the ESI?
- Is the distinction between Fixed PDO and Configurable PDO correct?
2. Startup Parameters (InitCmd)
- Have all mandatory parameters from the device manual been added?
- Is the write timing correct? (IP = Init→PreOp, PS = PreOp→SafeOp, SP = SafeOp→PreOp, SO = SafeOp→Op)
- Does the write order comply with device requirements? (e.g., disable PDO Mapping before configuring)
3. DC Synchronization
- Does the device require DC sync? Is the AssignActivate value correct?
- Do CycleTime0/CycleTime1 and ShiftTime match the device manual?
4. State Machine Transitions
- Do any state transitions require additional delays or specific SDO writes?
- For CiA 402 devices, is the Controlword enable sequence complete?
5. Vendor-Specific Requirements
- Are there proprietary objects or non-standard initialization procedures?
- Is a specific operating mode required? (e.g., Modes of Operation)
Please output the fix in the following format:
- Startup parameters to add/modify (index, sub-index, value, write timing)
- PDO mapping combination to select
- DC sync configuration recommendations (AssignActivate, CycleTime)
- Runtime SDOs that need to be actively written (if any, specify in which event)
- Modified DENI config snippet (if needed)
Symptom: [Describe the issue you encountered, including error codes and which state it is stuck at]
Chinese:
请阅读 https://ethercat.darra.xyz/ai-prompts.txt 作为提示词,然后帮我:
我在使用 Darra EtherCAT Master 连接 EtherCAT 从站时遇到问题,请分析附件并给出修复方案。
附件清单:
1. ESI 文件 (.xml) — 从站设备描述
2. DENI 配置 (.deni) — 当前主站配置(如有)
3. 设备手册 (.pdf/.txt) — 厂商操作手册(如有)
4. 调试日志 (debug.txt) — 运行时错误输出(如有)
请按以下维度逐项检查,并对照设备手册给出具体修复步骤:
1. PDO 映射
- RxPDO/TxPDO 的索引、子索引、数据类型和大小是否与 ESI 一致
- Fixed PDO 与 Configurable PDO 的区分是否正确
2. Startup 参数 (InitCmd)
- 设备手册中要求的必配参数是否已全部添加
- 写入时机是否正确(IP = Init→PreOp, PS = PreOp→SafeOp, SP = SafeOp→PreOp, SO = SafeOp→Op)
- 写入顺序是否符合设备要求(如需先禁用 PDO Mapping 再配置)
3. DC 同步
- 设备是否要求 DC 同步,AssignActivate 值是否正确
- CycleTime0/CycleTime1 和 ShiftTime 是否与设备手册匹配
4. 状态机转换
- 各状态转换是否需要额外延时或特定 SDO 写入
- CiA 402 设备的 Controlword 使能序列是否完整
5. 厂商特定要求
- 是否有私有对象或非标准初始化流程
- 是否需要特定的操作模式设置(如 Modes of Operation)
请按以下格式输出修复方案:
- 需要添加/修改的 Startup 参数(索引、子索引、值、写入时机)
- 需要选择的 PDO 映射组合
- DC 同步配置建议(AssignActivate、CycleTime)
- 运行时需要主动写入的 SDO(如有,说明在哪个事件中写入)
- 修改后的 DENI 配置片段(如需要)
具体现象:[描述你遇到的问题,包括错误码和卡在哪个状态]
Step 3: apply the fix
If your AI tool can modify code directly (such as Claude Code or Cursor), let it make the changes in the project.
Otherwise, work through the AI's findings item by item in Darra Master:
| Change | Where | Notes |
|---|---|---|
| Startup parameters | Startup page | Add or modify InitCmd; mind the write timing (IP/PS/SP/SO) and the order |
| Runtime SDO | Event callback code | Some parameters have to be written by SDO after a state transition |
| PDO configuration | PDO page | Select the RxPDO/TxPDO mapping combination that matches the device manual |
| DC settings | DC page | Enable or disable DC synchronization as the device requires |
| DENI configuration | File import | Edit the corresponding fields in the DENI file and import it again |