IMD SolutionComputing LibraryShop main store

Troubleshooting

TwinCAT Visual Studio freezes when connected to an IPC target

Operating systems on the plant floor Published 8 min read

Short answer

The 5 to 10 second stalls in Visual Studio are ADS timeouts on the link between the engineering PC and the IPC, not real-time or CPU problems: pointing the target at the local system or pulling the cable clears them. Work link negotiation, hostname routes, competing adapters and the ADS TCP session on port 48898, then finish with static addresses and an IP-based route.

On this page
  1. Two tests that isolate the stall
  2. Why 4 percent CPU on 32 cores rules out the PC itself
  3. Check the physical link first
  4. Check the ADS route and its name lookups
  5. Check which adapter carries the traffic
  6. Check the ADS TCP session itself
  7. Fix and verify the link
  8. Questions asked

Every click in Visual Studio taking five to ten seconds while a TwinCAT target is connected is an ADS wait on the link between the engineering PC and the IPC — not a real-time problem and not a CPU problem. Two facts prove it: the freeze vanishes the moment you point the target at the local system entry or pull the Ethernet cable, and the process outputs keep following the running program smoothly through every stall. The engineering shell sends its ADS requests from its user-interface thread, so any request that waits on a reply blocks scrolling, tree expansion and every menu for the length of the wait. Work the checks below nearest-first — physical link, route and name resolution, competing adapters, then the ADS TCP session — and close with static addresses and an IP-based route.

Two tests that isolate the stall #

The setup behind this article: a Windows 10 engineering station running TwinCAT 3 build 4024, an embedded IPC driving a dozen I/O terminals, a compiled TcCOM object activated on the target, and one Ethernet cable between the two machines.

Run these two tests before touching any setting; each result cuts the suspect list.

  • Point the target at the local system and work offline. If the freeze is gone, Visual Studio itself, the project size and the PC's compute are all clean, and only the path to the remote target remains in play.
  • Pull the cable with the remote target still selected. If the freeze is gone, the PC's software load is clean too; what remains is the link, the NIC, name resolution, the ADS route and the target's ADS response.
  • A fault that clears itself for a couple of days and then returns rules out a fixed wrong setting such as a subnet mask. Something that expires or changes fits: address leases, caches, link renegotiation, adapter metrics.
  • Log warnings that are always present, with no new entries when the freeze hits, argue against a new target-side fault as the primary cause.

Together these place the fault between the Windows network stack on the PC and the ADS router on the target. The shell polls the target from its UI thread, which is why one slow reply freezes the whole program rather than a single dialog. This is a link problem, not a hardware-compatibility one; the separate question of what a runtime needs to run well on third-party hardware is covered in Running TwinCAT XAR on a third-party industrial PC.

Why 4 percent CPU on 32 cores rules out the PC itself #

Inputs. From the reported case: total CPU use during a stall below 4 percent on an engineering PC with 32 logical cores; a stall of 5 to 10 seconds on every action; process outputs holding phase throughout each stall; no single process bloated in Task Manager.

Rule. A program that freezes for lack of compute must be queuing for CPU time, and total capacity is cores multiplied by 100 percent each. If everything on the PC together sits far below that capacity during the stall, the freeze is a wait for an outside reply, not a compute shortage.

Arithmetic. Capacity: 32 cores × 100 percent = 3,200 percent. Observed use: 4 percent, so 0.04 × 32 = 1.28 cores busy and 32 − 1.28 = 30.72 idle. Even a 10 percent moment is 0.10 × 32 = 3.2 cores busy, 28.8 idle. Around 31 idle cores cannot make a mouse click wait 5 to 10 seconds.

Result. The PC is not compute-bound during the stall; the wait sits outside it.

Decision. While total CPU stays under about 10 percent during the pause and the outputs hold phase, treat the stall as a communication wait and work the four link checks below. Only a CPU pinned near saturation with the same pause would send you back to the PC itself — and then Task Manager would show a named process eating the time, which this case does not.

A direct patch cable between PC and IPC removes switches, VLANs and VPN latency from the suspect list, leaving the cable, the two network interfaces and their negotiation. Read link state and error counters while a freeze is active.

  1. Speed below 1 Gbit/s, half duplex, or a speed that differs between reads: replace the cable, then set speed and duplex explicitly in the adapter's advanced properties to match the target port, and switch off the adapter's energy-efficient or green Ethernet power-saving option.
  2. Receive errors or discards counting up, or any loss on a continuous ping: swap the cable and try another port or adapter before going further.
  3. No loss, stable speed, round-trip time well under a millisecond: the wire is clean; move to the route check.

Check the ADS route and its name lookups #

A pause of several seconds on every action is the timeout signature, and on an isolated point-to-point link the usual source is name resolution. If the ADS route to the IPC is stored as a hostname, or the IPC's address changed after the route was written, each operation can fire DNS, then LLMNR, then NetBIOS lookups that each wait out their full timeout with no name server on the link to answer.

  1. Open the routes dialog (SYSTEM > Routes under the TwinCAT 3 solution explorer) and read the address held for the route to the IPC: a name or an IP.
  2. Read the IPC's real address in its Windows network settings and compare.
  3. Capture one freeze on the PC's NIC in Wireshark with the display filter dns || llmnr || nbns, and look for queries sent with no reply before the pause.

Outcomes:

  • Hostname in the route, or unanswered name queries right before the pause: this is the cause; go to the fix below.
  • Route holds an address the IPC no longer has: the route points at a dead address; correct it, then apply the fix.
  • Route holds the correct IP and no name queries appear: move to the adapter check.

Check which adapter carries the traffic #

An engineering station with several adapters — Wi-Fi, virtual switches, VPN clients, a second wired port — can send target traffic out the wrong interface as metrics shift. That is exactly the fine-for-days, broken-again pattern.

  1. In PowerShell, list interfaces with their metrics sorted by InterfaceMetric from Get-NetIPInterface, per-adapter configuration with Get-NetIPConfiguration, and the routes to the IPC subnet with Get-NetRoute.
  2. IPC subnet reachable through more than one interface, or the wired NIC holding an automatic 169.254.x.x address: give that NIC a static address on the IPC's subnet only, and disable competing adapters during commissioning or set their metric above the wired NIC.
  3. ADS NIC bound to the TwinCAT real-time Ethernet driver: Windows no longer serves that adapter normally; remove the binding for the ADS NIC in the TwinCAT real-time Ethernet compatible devices dialog.
  4. One adapter, static address, correct subnet: confirm which physical port on the IPC the cable occupies. A port assigned to real-time Ethernet or the fieldbus master on the target is not a Windows-side path; move the cable to a standard Windows port, then capture the ADS session.

Check the ADS TCP session itself #

ADS rides on TCP port 48898, so the session's behavior shows in the capture rather than in the IDE. Capture during a freeze, filter tcp.port == 48898, then add tcp.analysis.retransmission || tcp.analysis.zero_window.

Capture pattern at the stall What it means What to do
Request sent, seconds of silence, retransmission Packet loss or a physical-layer fault Back to the link check with a different cable and port
Request acknowledged, ADS response slow to follow The target's ADS router or its Windows side is slow Compare TwinCAT versions on PC and target; check CPU and network load in the IPC's Windows
PC advertises a zero window NIC driver or offload fault on the PC Update the NIC driver; disable large-send and receive-side offload on that adapter
No gap in the capture, but the UI still stalls The delay lives inside the engineering shell Repair or reinstall the TwinCAT engineering installation, then revisit the local-target test result

Keep the machine in a safe state for this: deleting routes and reactivating the configuration cuts ADS traffic and can stop a running process.

  1. Give the PC's NIC and the IPC's Windows port static addresses in one subnet under one mask, and leave the default gateway empty on this point-to-point link.
  2. Disable Wi-Fi, unused virtual switches and VPN clients during commissioning, or set their metric above the wired NIC.
  3. Delete the existing route to the IPC and create it again with the IPC's IP address as its address, never its name.
  4. Set speed and duplex at both ends if the link check showed renegotiation, and leave the power-saving Ethernet option off.
  5. Remove any real-time Ethernet binding from the NIC that carries ADS.
  6. Restart the PC to clear the ARP and name caches, then reactivate the configuration on the target.

Then verify:

  • With the remote target selected and Run mode active, run a continuous ping: zero percent loss and a steady round-trip time.
  • Scroll the solution tree, expand several nodes and open the object's online view: every action must answer without the 5 to 10 second pause.
  • Repeat after a PC restart and again after several days of uptime, because the original fault came back after two or three clean days. If it returns, capture on tcp.port == 48898 and compare the silent gap against the session check above.

A dedicated wired NIC and its own subnet also keep engineering traffic off the office path, which is where layered OT security controls that protect a network path begin.

Questions asked

Does the stall grow with the size of the project or the loaded object?

No. The reported case saw the same 5 to 10 second pause with every object, large or small, because the wait sits in the transport path rather than in the object. Project size moves compile and download times, which happen once per activation, not the delay on each click while online. If slow downloads are the complaint, that is a separate check from this per-action freeze.

Why does the fault clear for a few days and then come back?

That pattern points at state that expires or changes on its own: an address lease renewed onto a different IP, ARP or resolver cache entries aging out, Wi-Fi reconnecting and taking the default route, or a link renegotiating its speed. A fixed wrong setting, such as a bad subnet mask, would never allow two clean days first. Static addresses and an IP-based route remove those variables together.

Should the network driver on the engineering PC be updated first?

An update alone rarely fixes this and it destroys the evidence. Run the four checks first so a capture shows whether packets are lost, delayed or never sent. Update the driver when the session check shows a zero-window stall, or retransmissions that survive a cable and port swap, because either points at the adapter and its offload settings rather than at the route.

Which ports and traffic must pass between the engineering PC and the IPC?

ADS over TCP uses port 48898, and a firewall on either side that filters it produces connection failures or stalls rather than a clean error. Target discovery uses broadcast traffic on the same link, so a network path that blocks broadcasts hides targets from the search list even when a manually created route would work. Check both when the route looks right but the target will not connect.

Can the engineering station work over Wi-Fi once the freeze is fixed?

It can, but the pause follows the slowest hop, because the shell holds one TCP session to the target and every lossy or high-latency stretch puts a wait back into each click. Keep the wired link for online tuning, commissioning and forcing variables, and use Wi-Fi for work that tolerates delay. The same rule applies to any remote path into the machine network.

Keep reading

  • How-to

    Running TwinCAT XAR on a third-party industrial PC

    Do not clone a factory IPC image onto other hardware. Install a licensed Windows 10 IoT Enterprise LTSC edition, install the runtime fresh, and qualify the real-time Ethernet port, CPU priority and jitter on the actual machine. A successful boot proves nothing, and network hardware the runtime vendor did not sell you is a self-supported component.

    Operating systems on the plant floor

  • Troubleshooting

    Fix TwinCAT IPC staying in Config mode after power cycle

    Set Auto Boot to Run mode under Boot Settings (Target) in SYSTEM > SETTINGS and activate the configuration. If the IPC still boots to Config mode, read the TwinCAT runtime build on the target itself: one reported 4024-to-4026 migration behaved this way until the runtime was returned to 4024.67.

    Operating systems on the plant floor

  • Comparison

    Remote SCADA access through firewalls and proxies

    Put the SCADA application and its data connections on the plant side of the firewall and carry only an authenticated VPN tunnel and a rendered remote session across it. A proxy forwards traffic under its administrator's policy and issues no licenses; session CALs are deployed and tracked on the session host. Restrict tunnel routes to that one host, license by counted people or devices, and keep direct port forwarding to an HMI host out of the design.

    Remote access and virtualization