ethercat-linux/scripts
2026-08-12 17:39:50 +08:00
..
d2000-deploy.ps1 D2000 (aarch64) migration: cross-build works with zero code changes 2026-08-06 02:05:05 +08:00
debug-sysmgr.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
find_j1900.py EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
prune-tsproj.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
README.md EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
serial_exec.py EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-activate-helper.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-activate-restart.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-activate-rm-errors.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-activate-rm.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-activate.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-ads-lag.ps1 Soak sampler: add atomic nMatchLag freshness monitoring; add lag sampling script 2026-08-12 17:39:50 +08:00
tc-ads-mismatch-delta.ps1 800B PDO variant + long-term stability evidence + analysis docs 2026-08-06 01:10:50 +08:00
tc-ads-probe.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-ads-quick.ps1 Enable EL6695 DC-Synchron mode (AssignActivate 0x320) 2026-08-09 15:32:56 +08:00
tc-ads-readstate.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-ads-rtt.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-ads-setrun.ps1 Enable EL6695 DC-Synchron mode (AssignActivate 0x320) 2026-08-09 15:32:56 +08:00
tc-ads-soak.ps1 Soak sampler: add atomic nMatchLag freshness monitoring; add lag sampling script 2026-08-12 17:39:50 +08:00
tc-ads-start-runtime.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-ads-state.ps1 Enable EL6695 DC-Synchron mode (AssignActivate 0x320) 2026-08-09 15:32:56 +08:00
tc-ads-verify-800b.ps1 800B PDO variant + long-term stability evidence + analysis docs 2026-08-06 01:10:50 +08:00
tc-ads-watch-10min.ps1 Extend async pipelined FPWR to 800B: 4kHz spin loop 2040->2960 cycles/s 2026-08-10 01:28:43 +08:00
tc-ads-watch.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-build-activate-local.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-build-activate.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-build-diag-2khz.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-build-diag.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-build-output-2khz.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-check-el6695.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-check-ip.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-check-network.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-check-project.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-check-state.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-check-system.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-common.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-compare-bak.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-configure-pdo.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-deploy-full.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-deploy-primary.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-deploy-retry-2khz.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-deploy-retry-4khz.ps1 Async pipelined FPWR + 4kHz: exec 245us->24us, RTT 2ms->1.25-1.5ms 2026-07-28 01:18:05 +08:00
tc-deploy-retry-800b.ps1 800B PDO variant + long-term stability evidence + analysis docs 2026-08-06 01:10:50 +08:00
tc-deploy-retry.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-deploy.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-diag-dte.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-diag-online.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-dte-activate-run.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-dte-commands-test.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-dte-list-commands.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-dte-restart-system.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-dump-mapping.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-dump-tirr.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-dump-tirt.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-enum-cfgmgr.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-enum-root.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-errors.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-export-el6695.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-export-tiid.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-find-basetime.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-find-commands.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-find-system-node.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-fix-and-activate.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-fix-pdo-primary.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-inspect-link.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-json-cmd.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-list-commands.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-list-rot.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-list-vs-windows.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-monitor-5h.ps1 800B PDO variant + long-term stability evidence + analysis docs 2026-08-06 01:10:50 +08:00
tc-online-info.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-open-project-800b.ps1 Enable EL6695 DC-Synchron mode (AssignActivate 0x320) 2026-08-09 15:32:56 +08:00
tc-open-project.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-parse-online-xml.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-register.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-relink-800b.ps1 800B PDO variant + long-term stability evidence + analysis docs 2026-08-06 01:10:50 +08:00
tc-relink.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-rt-node.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-scan-demo.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-scan-xae.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-scan.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-set-ethercat-ip.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-start-runtime.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-switch-target.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-task-rate.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00
tc-verify.ps1 EL6695 8-byte bidirectional exchange with per-byte verification 2026-07-27 19:01:05 +08:00
tc-walk-tree.ps1 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle 2026-07-28 00:11:34 +08:00

TwinCAT 自动化基础脚本

路径: C:\Users\tonycao\work\ethercat-linux\scripts\

脚本清单

脚本 功能 用途
tc-common.ps1 共享函数库 被 other 脚本 source不单独运行
tc-register.ps1 注册 COM 组件 首次使用时运行一次
tc-activate.ps1 激活配置 $sysMgr.ActivateConfiguration() + StartRestartTwinCAT()
tc-configure-pdo.ps1 配置 EL6695 PDO ConsumeXml 注入 1024 字节 PDO
tc-verify.ps1 验证配置 导出 EL6695 XML检查 PDO entries
tc-scan.ps1 扫描 EtherCAT 在线扫描总线设备
tc-switch-target.ps1 切换目标 NetID 修改项目目标地址
tc-deploy.ps1 全流程编排 configure → activate → verify

快速使用

首次使用

# 1. 注册 COM 组件(管理员 PowerShell
.\scripts\tc-register.ps1

# 2. 全流程部署(配置 PDO + 激活 + 验证)
.\scripts\tc-deploy.ps1

日常操作

# 仅激活配置PDO 已在 tsproj 中配好)
.\scripts\tc-activate.ps1

# 验证当前配置
.\scripts\tc-verify.ps1

# 扫描总线
.\scripts\tc-scan.ps1

EL6695 1KB PDO 完整流程

# 1. TwinCAT 侧:部署 + 激活
.\scripts\tc-deploy.ps1

# 2. J1900 侧:存储 EEPROM通过 SSH
ssh root@J1900 'echo 73617665 | xxd -r -p > /tmp/save.bin'
# 或通过 el6695_rt 的 verify 模式观察

# 3. J1900 侧:软复位 + Consumer 验证
ssh root@J1900 '/root/gateway/el6695_rt eth1 --consumer --mode verify'

关键设计决策

为什么用 ActivateConfiguration() 而不是 ExecuteCommand("TwinCAT.激活配置")

DTE 的 ExecuteCommand 使用本地化命令名(中文环境是 TwinCAT.激活配置 编码/语言版本不同时容易出错。ITcSysManager.ActivateConfiguration() 是 automation interface 的直接方法调用,与语言无关。

为什么用 TcSysManCmdHelper 做 PDO 配置?

ConsumeXml 是 Beckhoff 官方 CLI 工具支持的 XML 注入方式, 不需要打开 DTE 窗口,适合脚本化。

默认路径

Solution: C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Secondary\TwinCAT_EL6695_Secondary.sln
Tsproj:   C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Secondary\TwinCAT_EL6695_Secondary.tsproj
Logs:     C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Secondary\Logs\
Target:   10.0.0.106.1.1 (local UmRT)

可通过参数覆盖,如:

.\scripts\tc-activate.ps1 -Solution "C:\other\path.sln" -TargetNetId 10.0.0.111.1.1