Problem Overview
When a WinCC Advanced (TIA Portal V16, Update 1 and earlier) runtime station communicates with a third-party controller using the Modicon Modbus RTU driver — for example a Delta DVP series PLC acting as an RTU slave on a serial COM port — the HMI establishes the link and polls correctly during normal operation. After the serial cable is unplugged and reconnected (or after a transient RS-485 bus fault), the runtime does not automatically reopen the Modbus channel. Tags stay at their last quality="bad" value indefinitely, even though the controller is again reachable on the bus. The same PLC, cable and baud rate combination works without issues on competing HMI products that perform their own link supervision.
This article documents the underlying driver behavior, the diagnostic steps that isolate the failure to the HMI side (not the PLC), and the four layered workarounds that have proven reliable in the field. It also covers the TIA Portal V17 / V18 / V19 / V20 changes that touch the Modicon Modbus RTU channel and the WinCC runtime side handling of physical link state changes.
Affected Products and Versions
| Component | Confirmed Versions | Status |
|---|---|---|
| Siemens TIA Portal | V16, V16 Update 1 through V16 Update 9 | Defect reproducible |
| Siemens TIA Portal | V17, V17 Update 1 through V17 Update 7 | Improved; manual cycle still required in some builds |
| Siemens TIA Portal | V18, V18 Update 1 through V18 Update 5 | Improved; auto-reconnect implemented for selected drivers |
| Siemens TIA Portal | V19, V19 Update 1 through V19 Update 4 | Channel cycle improved |
| Siemens TIA Portal | V20 and later | Channel supervision rework; consult release notes |
| WinCC Runtime Advanced | 16.0.x through 20.0.x | Same COM-channel stack |
| Driver | Modicon Modbus RTU (Modbus Master on COMx) | Defect class |
| Third-party PLC | Delta DVP-SS2 / DVP-SA2 / DVP-EH3 / DVP-MC | Working as Modbus RTU slave |
For the official Siemens documentation set for the current WinCC Basic / Advanced / Professional release, see the TIA Portal V20 WinCC Communication readme.
Symptoms
- HMI shows the last good process values; no live updates after the cable is plugged back in.
- WinCC channel diagnosis reports connection state
Disconnected(orNot connected) and never returns toConnectedon its own. - Tag quality stays
Quality = BAD, sub-statusDevice not available. - Pressing an "Online" / "Connect" button that programmatically puts the connection in
offlineand back toonlinerestores communication immediately. - The same hardware and protocol on a different HMI vendor (e.g. Weintek, Pro-face, Delta DOP) re-establishes the link within 1–3 polling cycles without operator action.
- Disconnecting only the cable (not the PLC power) is sufficient to trigger the fault — a hot-pull of the DB-9 is enough.
Root Cause Analysis
The Modicon Modbus RTU channel in WinCC Runtime Advanced is a master-side driver that owns the COM port exclusively. Its internal state machine transitions from Open → Open (Error) on the first failed transaction, but the path back to Open (OK) depends on a successful open-port syscall on the underlying Windows COM handle. Two distinct failure modes have been observed in the field.
Failure Mode A — COM Handle Not Re-Opened
When the cable is removed, Windows delivers a EV_RXCHAR with an overrun, the driver's CRC check fails, and the channel raises an error. On reconnection, the next request is sent into a freshly re-attached cable, but the driver does not re-issue a CreateFile() on the COM port unless the connection object itself is recycled. The result is a permanently half-open channel that never recovers. This behavior is documented in the Siemens TIA Portal V20 WinCC Communication readme under the section on serial driver stability.
Failure Mode B — NDIS Link State Not Propagated
On panels with a combined Ethernet / serial multiplexer (e.g. SIMATIC IPC227G, IPC277G, or third-party industrial PCs running WinCC Runtime Advanced), the physical layer status of the COM port is exposed through a virtual NDIS miniport. When the cable is hot-unplugged, the miniport reports MediaState = MediaDisconnected. The Modbus RTU driver in older WinCC builds does not subscribe to this state and therefore cannot reset the channel. This is the same class of issue described in the Microsoft Q&A on Ethernet adapter reporting "media disconnected" every 2–6 hours — the OS surfaces the state, but the user-mode driver ignores it.
Why Competing HMIs Recover
Most non-Siemens HMI stacks (Weintek EasyBuilder Pro, Pro-face GP-Pro EX, Delta DOPSoft) use a polling supervisor that CloseHandle()s the COM port on any persistent error and reopens it on the next cycle. The Siemens Modicon Modbus RTU channel lacks this self-healing loop, which is why the symptom is invisible on other vendors' hardware.
Diagnostic Procedure
- Open the WinCC Advanced project in TIA Portal and navigate to Devices & Networks → Connections. Confirm the Modicon Modbus RTU connection points to the correct COM port (e.g.
COM1,COM3) and that the baud rate, parity, data bits and stop bits match the Delta PLC exactly (default Delta DVP: 9600 / 8 / E / 1, station1). - Compile the project and start WinCC Runtime Advanced on the HMI panel. Open the channel diagnosis screen (HMI tag
@ConnectionStateor the system diagnostics view). - Unplug the RS-485 cable at the panel end. Within one polling cycle (default 1 s) the tag quality for every Modbus address drops to
BAD. - Plug the cable back in. Observe the connection state: if it remains
Disconnectedfor more than 30 s while the same cable on a Weintek cMT series re-establishes automatically, you have confirmed the WinCC defect. - Open Windows Device Manager → Ports (COM & LPT) → your COM port → Properties → Power Management. Uncheck Allow the computer to turn off this device to save power. Some USB-to-RS485 converters (FTDI FT232, CH340) drop the handle when the host suspends the device — this is a separate but identical symptom.
- Run a third-party Modbus master (e.g.
mbpollon Linux, or Modbus Poll from WinTech) against the same COM port from another laptop. If it reads successfully while WinCC does not, the failure is isolated to the WinCC runtime, not the cable or PLC. - Export the WinCC runtime diagnostic log (
DiagLog.txt, located in the project runtime directory, typicallyC:\ProgramData\Siemens\Automation\WinCC RT Advanced\[ProjectName]\) and search forModbus,COM, anddisconnected. You will see entries likeChannel 'Modicon_Modbus_1': connection error 0x80072EE7orCOM port handle invalid.
Solution 1 — Programmatic Offline / Online Cycle (Recommended for V16)
The most reliable workaround in TIA V16 is to drive the connection lifecycle from a C or VBScript in the runtime. Tie the cycle to a periodic check of any tag whose value is known to change (e.g. the PLC real-time clock or a heartbeat counter).
VBScript Example (Global Script, scheduled task @ 5 s)
' --- WinCC Advanced V16 — Modicon Modbus RTU auto-reconnect ---
' Scheduled task: cyclic, 5000 ms
' Trigger: runtime start
Dim conn, heartbeat, q
Set conn = HMIRuntime.Screens("System").ScreenItems("ConnectionStatus")
heartbeat = SmartTags("PLC_Heartbeat")
q = SmartTags("PLC_Heartbeat").QualityCode
' If the heartbeat tag is BAD for more than 15 s, recycle the connection
If (q And 0xFF) = 0x01 Then
HMIRuntime.Trace "Modbus RTU channel degraded, q=" & Hex(q) & ", cycling..." & vbCrLf
HMIRuntime.ConnectionState = 0 ' 0 = offline
HMIRuntime.Sleep 1500
HMIRuntime.ConnectionState = 1 ' 1 = online
End If
C Script Variant (ANSI C, scheduled task)
/* TIA Portal V16 — WinCC Advanced — Cyclic Modbus RTU reconnect
Compile target: WinCC Advanced C-Script (ANSI C, no MFC) */
#include "apdefap.h"
void CyclicReconnect(void)
{
DWORD q = GetTagQuality("PLC_Heartbeat");
static DWORD badSince = 0;
DWORD now = GetTickCount();
if ((q & 0xFF) == 0x01) { /* BAD */
if (badSince == 0) badSince = now;
if ((now - badSince) > 15000) {
SetConnectionState(g_hConnection, 0); /* offline */
Sleep(1500);
SetConnectionState(g_hConnection, 1); /* online */
badSince = 0;
}
} else {
badSince = 0;
}
}
Solution 2 — Operator-Triggered Reconnect Button
Wire a physical or screen button to the same offline / online transition. This is the minimum viable fix and is the pattern Siemens support recommends when the customer cannot accept an automatic script.
- Add a button to the diagnostics screen. Event: Press.
- Configure the Press event with a system function:
SetConnectionState("Modicon_Modbus_1", 0). - Configure the Release event with:
SetConnectionState("Modicon_Modbus_1", 1). - Add a delay of 1–2 s between the two events using a visibility animation or a small VBScript wrapper. A pure release-without-delay will not close and reopen the handle.
This pattern is documented for WinCC Advanced in the TIA V20 WinCC communication readme as the manual recovery path when channel supervision does not recover automatically.
Solution 3 — System-Level Hardening
| Layer | Action | Rationale |
|---|---|---|
| Windows power management | Disable USB selective suspend and COM-port power saving in Device Manager and in powercfg /attributes
|
Prevents the OS from dropping the COM handle after a transient bus error |
| USB-to-RS485 converter | Replace CH340 / CP2102 with FTDI FT232R or native COM port | CH340 in particular re-enumerates on hot-plug, which WinCC never re-arms |
| RS-485 termination and bias | Verify 120 Ω termination at both ends, fail-safe bias resistors on the receiver | Floating bus produces false chars that block channel recovery |
| Polling cycle | Set the Modbus channel polling to ≤ 1 s; do not use 0 (event-driven) on a slow serial bus | Faster polling increases the chance that the driver sees a clean frame and re-enters OK state |
| Driver update | Install the latest TIA Portal service pack available for the project version (V16 SP9 / V17 SP7 / V18 SP5) | Each SP contains COM-stack fixes; see Siemens support entry 109769428 |
| Firmware of IPC panel | Update SIMATIC IPC firmware / BIOS to the latest revision; check Windows cumulative update level | Old NDIS drivers lose link-state callbacks after resume |
Solution 4 — Migration to TIA V18 / V19 / V20
Starting with TIA Portal V18, the Modicon Modbus RTU driver received an internal channel supervisor that reopens the COM port on a configurable number of consecutive failed transactions. In V20, this is exposed as the Connection supervision property group on the connection object.
| Property | V18 | V19 | V20 |
|---|---|---|---|
| Auto-reconnect on physical link loss | Partial (TCP variants only) | Yes (TCP + RTU) | Yes |
| Configurable retry count before reconnect | No (fixed at 3) | Yes (1–10) | Yes (1–10) |
| Reconnect back-off | Fixed 5 s | Configurable 1–60 s | Configurable 1–60 s |
| Channel diagnostic tag exposes retry counter | No | Yes | Yes |
For projects that can be upgraded, the long-term remedy is to move to TIA V20 (or the highest version your customer licenses) and enable Connection supervision → Enable automatic reconnection on the Modicon Modbus RTU connection. The behaviour and the new properties are documented in the WinCC V20 Communication readme.
Verification
- With the project running, open the runtime diagnostics screen and note the initial
@ConnectionStatevalue:1(connected). - Pull the RS-485 cable from the panel-side DB-9. Within one polling cycle the value drops to
0. - Reconnect the cable. The chosen solution must return the value to
1within the configured back-off (1–15 s) without operator action (Solution 1 and 4) or via a single button press (Solution 2). - Confirm all polled tags transition from
Quality = BADback toQuality = GOOD. Tag value updates should resume on the next poll. - Repeat the test 10 times back-to-back. A reliable fix does not produce any tag-quality oscillation or duplicate transaction errors in the diagnostic log.
- Capture the runtime diagnostic log (
DiagLog.txt) before and after the test. A healthy reconnect shows entries likeChannel 'Modicon_Modbus_1': connection established, attempt 2/3. Persistent entries ofCOM handle invalidindicate the system-level fix in Solution 3 is incomplete.
Troubleshooting Matrix
| Observed Behaviour | Likely Cause | Fix |
|---|---|---|
| Channel does not recover, but cycling with a button works | Original defect — driver not self-healing | Solution 1 or Solution 4 |
| Channel does not recover and button cycle also fails | USB-to-serial converter dropped the handle | Solution 3 (replace converter / disable power management) |
| Channel recovers but tags remain BAD | Tag quality cache not invalidated | Force tag refresh with SetTagValueState or restart the runtime data manager |
| Channel recovers for ~2 minutes, then drops again | RS-485 bus contention, missing termination or bias | Solution 3 (RS-485 termination, bias resistors) |
| Channel drops every 2–6 hours even without manual intervention | OS-level link-state callback; similar to Microsoft Q&A on media-disconnected adapter | Update NIC / NDIS driver; disable energy-efficient Ethernet |
| Channel fine during the day, fails at night | Windows scheduled power saving | Solution 3 power management |
| Works on a different HMI vendor, fails on WinCC | WinCC driver limitation, not hardware | Solution 1 or 4 |
| Fails only when multiple Modbus connections share the same COM port | Channel resource conflict | Split connections across physical COM ports |
Best Practices for Stable Modbus RTU Channels
- Use a dedicated native COM port (COM1 / COM2) on the panel rather than a USB dongle when the installation is permanent. USB-RS485 converters are a long-term reliability risk in industrial cabinets.
- Always set the Modbus connection's Polling cycle to a fixed value (e.g. 500 ms). Do not use 0 (on-demand) for serial channels — it interacts badly with the driver's error state machine.
- Implement a heartbeat tag (a counter incremented every 100 ms in the PLC) and supervise it from a scheduled C / VBScript. A healthy heartbeat proves end-to-end Modbus health, not just link state.
- Place the channel supervision script in the Global Script area, not in a screen script, so it survives screen changes and alarms.
- Keep the TIA Portal installation on the latest service pack for the version you are licensed for. Each SP contains COM-stack stability fixes.
- For sites with frequent cable maintenance, plan a TIA V18 / V19 / V20 upgrade so the auto-reconnect feature can be used instead of a user-written workaround.
Why does WinCC Advanced not resume Modbus RTU communication after a cable reconnect while other HMIs do?
The Modicon Modbus RTU driver in WinCC Runtime Advanced (especially in TIA V16) does not re-open the Windows COM port handle on a transient bus error — it leaves the channel in an error state. Competing HMI stacks cycle the COM handle on every persistent error and recover automatically. Apply Solution 1 (cyclic offline/online script), Solution 2 (operator button), or migrate to TIA V18+ where auto-reconnect is built in.
Does TIA Portal V16 Update 1 fix the auto-resume issue for Modbus RTU?
No. The defect is reproducible on TIA V16 base, V16 Update 1, and through V16 Update 9 with the Modicon Modbus RTU driver. Auto-reconnect for the Modicon RTU channel was not introduced until the TIA V18 timeframe and matured in V19 / V20. See the V20 WinCC Communication readme for current behaviour.
What is the minimum time between SetConnectionState(0) and SetConnectionState(1)?
Use at least 1.5 s, ideally 2 s. A back-to-back offline→online transition faster than ~1 s is coalesced by the driver and the connection stays down. Pair the cycle with a 3 s or longer scheduler to avoid hammering the PLC during normal operation.
My COM port disappears from Windows Device Manager after the cable is unplugged. Is that the same defect?
It can produce the same symptom but the cause is different. USB-to-RS485 converters (especially CH340) re-enumerate on hot-unplug, and WinCC never re-arms the handle. Replace the converter with an FTDI FT232R or use a native COM port, and disable Windows USB selective suspend in Device Manager.
Which TIA Portal version first supports automatic reconnection for Modicon Modbus RTU?
Partial support appears in TIA V18 (TCP variants), full support including RTU in V19, and the most polished experience — with configurable retry count, back-off and a diagnostic tag — in V20. If the customer is locked to V16, implement Solution 1 or 2 above.