ethercat-linux/scripts/tc-set-ethercat-ip.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

25 lines
1.0 KiB
PowerShell

#Requires -RunAsAdministrator
$adapterName = "TwinCAT-Intel PCI Ethernet Adapter (Gigabit)"
$ip = "169.254.176.217"
$prefix = 16
$adapter = Get-NetAdapter -Name $adapterName -ErrorAction SilentlyContinue
if (-not $adapter) {
Write-Error "Adapter '$adapterName' not found. Available adapters:"
Get-NetAdapter -Physical | Select-Object Name, InterfaceDescription, Status | Format-Table -AutoSize
exit 1
}
Write-Host "Setting $adapterName to $ip/$prefix ..."
# Remove existing IP addresses on this adapter (IPv4 only)
Get-NetIPAddress -InterfaceIndex $adapter.ifIndex -AddressFamily IPv4 -ErrorAction SilentlyContinue | Remove-NetIPAddress -Confirm:$false -ErrorAction SilentlyContinue
# Set new IP
New-NetIPAddress -InterfaceIndex $adapter.ifIndex -IPAddress $ip -PrefixLength $prefix -AddressFamily IPv4 -ErrorAction Stop | Out-Null
# Verify
Get-NetIPAddress -InterfaceIndex $adapter.ifIndex -AddressFamily IPv4 | Select-Object IPAddress, PrefixLength, AddressState
Write-Host "Done. Now run tc-build-activate-local.ps1 to activate TwinCAT."