ethercat-linux/scripts/tc-parse-online-xml.ps1
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

35 lines
1.5 KiB
PowerShell

[xml]$doc = Get-Content -LiteralPath 'C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Secondary\Logs\online_master.xml' -Encoding UTF8
Write-Host "=== EtherCAT Master XML keys ===" -ForegroundColor Cyan
# Dump all distinct element names (first level under TreeItem)
$doc.TreeItem | Get-Member -MemberType Property | ForEach-Object { Write-Host $_.Name }
# Look for online-related fields
$xmlText = $doc.OuterXml
$patterns = @('Link', 'Frame', 'Online', 'State', 'Status', 'OpState', 'AlState', 'Tx', 'Rx', 'Slave', 'DeviceState', 'Connected')
foreach ($p in $patterns) {
$matches = [regex]::Matches($xmlText, "<$p[^>]*>[^<]*</$p>")
if ($matches.Count -gt 0) {
Write-Host "`nPattern $p found $($matches.Count) times:" -ForegroundColor Yellow
foreach ($m in $matches | Select-Object -First 20) {
Write-Host " $($m.Value)"
}
}
}
# Look for any attribute containing State/Link/Frame
Write-Host "`n=== Attributes containing State/Link/Frame/Online ===" -ForegroundColor Cyan
$nodes = $doc.SelectNodes('//*')
foreach ($n in $nodes) {
foreach ($a in $n.Attributes) {
if ($a.Name -match 'State|Link|Frame|Online|Status|Op') {
Write-Host " $($n.Name)@$($a.Name)=$($a.Value)"
}
}
}
# Write clean XML to file for manual inspection
$doc.Save('C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Secondary\Logs\online_master_formatted.xml')
Write-Host "`nFormatted XML saved to online_master_formatted.xml" -ForegroundColor Green