ethercat-linux/docs/1kb-verification-progress.md
Tony Cao 309aaba342 EL6695 8-byte bidirectional exchange with per-byte verification
- 8B PDO config: ULINT-sized payload, no 0x1A01 diag PDO on SM3
  (device rejected SM3=8 with diag assigned: 'size not allowed, min/max 0xa')
- twin_layout_blob_sized(): single 64-bit mapping entry for 8B payloads
- Ticker: per-byte XOR 0x5A transform in 8B mode so TwinCAT can verify
  every byte individually (1KB path unchanged, const-guarded)
- TwinCAT automation scripts: deploy with RPC retry, LinkVariables-based
  whole-array relink (element links only carry 1 byte), ADS watch, diag
- Docs: 8B design, verification methodology, test report
2026-07-27 19:01:05 +08:00

172 lines
6.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# EL6695 双向 1KB 实时通讯验证 — 进度跟踪
> **更新时间**: 2026-07-24 12:20
> **硬件状态**: 全部重启EL6695 EEPROM 加载默认值
> **目标**: 从零配置 TwinCAT + J1900验证双向 1KB 实时数据通讯
> **当前阻塞**: TwinCAT AmsNetId 与 EtherCAT 网卡 IP 不匹配,需要管理员权限修改
---
## 总体状态
| 阶段 | 状态 | 开始时间 | 完成时间 |
|------|------|----------|----------|
| 1. 环境检查 | ✅ 完成 | 22:47 | 12:20 |
| 2. TwinCAT 激活 | 🔶 阻塞 | 12:20 | — |
| 3. J1900 ConfigOwner | ⬜ 未开始 | — | — |
| 4. Consumer 模式 | ⬜ 未开始 | — | — |
| 5. 1KB 数据完整性 | ⬜ 未开始 | — | — |
---
## 阶段 1环境检查
| # | 步骤 | 状态 | 结果 |
|---|------|------|------|
| 1.1 | 检查 TwinCAT 安装 + TcSysManCmdHelper.exe | ✅ | TcSysManCmdHelper OK (4026.0), DTE .Object 返回 null |
| 1.2 | 检查 .sln/.tsproj 完整性PDO 已配 1024B | ✅ | 初始空 PDO已通过 `Edit-EL6695-PdoXml.py` 注入 1KB Entry |
| 1.3 | 检查 J1900 连通性(通过跳板机) | ✅ | J1900 实际 IP 为 192.168.68.100(非 102串口可达el6695_rt 可运行 |
| 1.4 | 检查 EL6695 桥接器物理连接 | ✅ | J1900 eth1 可发现 EL6695 station 0x1000SM0/SM1 1024 字节 OK |
### 验证方法
```powershell
# 1.1 TcSysManCmdHelper
Test-Path "C:\Program Files (x86)\Beckhoff\TwinCAT\3.1\Components\Base\TcSysManCmdHelper.exe"
# 1.2 项目文件
Test-Path "C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Secondary\TwinCAT_EL6695_Secondary.sln"
# 1.3 J1900 串口访问(跳板机 ttyUSB0, 115200
# J1900 IP: 192.168.68.100, MAC: 00:e2:69:34:71:2c
# 1.4 EL6695 物理连接
/root/gateway/el6695_rt eth1 --mode probe --duration 3
# 期望: [0] Found EL6695, station 0x1000, SM0/SM1 len=1024
```
### 新发现
- J1900 实际 IP 是 `192.168.68.100`DHCP 范围第一个),不是 `102`
- J1900 已运行 `Linux 6.6.135-rt74`, `el6695_rt` 位于 `/root/gateway/el6695_rt`
- `rustbootd` 没有 DHCP 租约日志HTTP boot 也没有访问日志
- J1900 串口ttyUSB0是带外访问最可靠的方式
---
## 阶段 2TwinCAT 激活配置
| # | 步骤 | 状态 | 结果 |
|---|------|------|------|
| 2.1 | 通过 TcSysManCmdHelper 注入 1KB PDO Entry | ✅ | 0x1608/0x1A08 现在包含 1KB ARRAY[0..1023] OF BYTE |
| 2.2 | TcSysManCmdHelper 激活 + 重启 (`-c ActivateConfiguration,StartRestartTwinCAT`) | ✅ | Exit 0 |
| 2.3 | 确认 TwinCAT 进 OP / EL6695 在线 | ❌ | J1900 侧仍见 0x6000[0]=1, 0x7000[0]=1PDO assign 为空 |
### 阻塞根因
TwinCAT 本机 **AmsNetId 与 EtherCAT 网卡 IP 不匹配**
- 注册表 AmsNetId: `169.254.176.217.1.1`
- tsproj 中 Device AmsNetId: `169.254.176.217.2.1`
- 实际 TwinCAT-Intel 网卡 IP: `169.254.70.104/16`
TwinCAT 激活命令虽然返回 0但无法通过错误的 AmsNetId 绑定到实际 EtherCAT 网卡,导致 EL6695 未被真正配置。J1900 侧看到的 EL6695 仍处于未配置状态PDO assign 空0x6000/0x7000 仅 1 字节)。
### 解堵方案(需要管理员权限)
运行脚本 `ethercat-linux/scripts/tc-set-ethercat-ip.ps1`(以管理员身份):
```powershell
powershell -ExecutionPolicy Bypass -File "C:\Users\tonycao\work\ethercat-linux\scripts\tc-set-ethercat-ip.ps1"
```
该脚本会把 TwinCAT-Intel 网卡设为 `169.254.176.217/16`,与注册表 AmsNetId 匹配。然后再重新运行 `tc-build-activate-local.ps1`
### 命令
```powershell
# 1) 管理员身份设置 IP
powershell -ExecutionPolicy Bypass -File "C:\Users\tonycao\work\ethercat-linux\scripts\tc-set-ethercat-ip.ps1"
# 2) 激活 TwinCAT已修正 target 为 169.254.176.217.1.1
powershell -ExecutionPolicy Bypass -File "C:\Users\tonycao\work\ethercat-linux\scripts\tc-build-activate-local.ps1"
```
### 下一步IP 修正后)
- 在 J1900 上执行 `/root/gateway/el6695_rt eth1 --mode verify`,确认 0x6000/0x7000 展开为 1024 字节
- 如果仍只有 1 字节,需要检查 E-bus 物理连接EK1100 供电、TwinCAT 网卡到 EK1100 的网线)
---
## 阶段 3J1900 ConfigOwner 验证
| # | 步骤 | 状态 | 结果 |
|---|------|------|------|
| 3.1 | 编译 el6695-rt (cargo build --release) | ⬜ | |
| 3.2 | 部署到 J1900 (scp) | ⬜ | |
| 3.3 | 运行 `--mode verify`CoE 审计) | ⬜ | |
| 3.4 | 运行 ConfigOwner ticker 30s | ⬜ | |
| 3.5 | 检查 SAFEOP/OP + 数据循环 | ⬜ | |
### 关键指标
- SAFEOP/OP 成功
- layout hash = `0xEA8257F1`35 entries × 8192 bits
- tc_seq 单调递增
- tx_err=0, rx_err=0
- 非零字节数(目标 > 1验证 1KB 扩展是否生效)
---
## 阶段 4Consumer 模式验证
| # | 步骤 | 状态 | 结果 |
|---|------|------|------|
| 4.1 | 运行 Consumer ticker无 INIT→PREOP | ⬜ | |
| 4.2 | Consumer hash == ConfigOwner hash | ⬜ | |
| 4.3 | 连续运行 5 分钟无错误 | ⬜ | |
---
## 阶段 51KB 数据完整性验证
| # | 步骤 | 状态 | 结果 |
|---|------|------|------|
| 5.1 | TwinCAT PLC 写 walking-ones pattern | ⬜ | |
| 5.2 | J1900 读取 + 比对全 1024 字节 | ⬜ | |
| 5.3 | J1900 回写 transformed pattern | ⬜ | |
| 5.4 | TwinCAT 验证回写数据正确 | ⬜ | |
---
## 关键路径
```
TwinCAT PC (Windows)
└─ twincat3-auto-cli/TwinCAT_EL6695_Secondary/
├─ .sln / .tsproj (PDO 已配 ARRAY[0..1023] OF BYTE)
└─ Scripts/ (100+ 实验脚本)
scripts/ (新整理的基础脚本)
├─ tc-common.ps1 共享函数
├─ tc-activate.ps1 激活配置
├─ tc-configure-pdo.ps1 PDO 配置
├─ tc-verify.ps1 验证
├─ tc-scan.ps1 扫描
└─ tc-deploy.ps1 全流程
J1900 (192.168.68.102, via 192.168.58.8)
└─ /root/gateway/el6695_rt
├─ --mode verify CoE 审计
├─ --mode ticker 数据循环
├─ --consumer 消费者模式
└─ ConfigOwner 配置者模式(默认)
```
## 已知问题
| # | 问题 | 影响 | 规避方案 |
|---|------|------|----------|
| 1 | DTE `.Object` 返回 null | 无法通过 DTE 获取 SysManager | 用 TcSysManCmdHelper CLI |
| 2 | DTE ExecuteCommand 中文命令名编码错误 | 激活配置命令无法执行 | 用 TcSysManCmdHelper CLI |
| 3 | 扫描 INIT→PREOP 擦除 PDO assign/map | Consumer 模式 hash 总不匹配 | Consumer 做幂等写入 |
| 4 | 0x6000:01 只有 1 字节(除非 TwinCAT 扩展) | 只有 1 字节数据转发 | 需 TwinCAT 激活后不断电 |
| 5 | 0x1C10/0x1C11 写入损坏 CoE | 0x7000 对象消失 | SDO 白名单已实施 |
## 修订历史
| 日期 | 内容 |
|------|------|
| 2026-07-23 | 创建计划文档 |