Detecting S7-1200 to LOGO! 8 Communication Errors via T_DIAG
When a Siemens SIMATIC S7-1200 (FW 4.2 or later) exchanges data with a LOGO! 8 (FS4) over a wireless Ethernet bridge, the PLC and the LOGO! do not generate a native "link down" alarm that an operator can display without user logic. Engineers typically need a method that surfaces a lost connection in the HMI, on the LOGO! display, or in the PLC tag table. This reference covers three reliable techniques: the T_DIAG instruction, the LOGO! network input diagnostic attribute, and a life-bit (heartbeat) exchange. The article is written for TIA Portal V15 with S7-1200 FW 4.2 and LOGO! 8 FS4 (0BA8.Standard / 0BA8.S.E).
T_DIAG reports the state of a TCON-handled connection. The LOGO! network input diagnostic detects a lost Ethernet link on the LOGO! side. A life-bit covers both ends and survives wireless bridge resets, IP re-negotiations, and application-level faults. Use at least two of the three in production.1. Prerequisites
- PLC: SIMATIC S7-1200, CPU 1214C/1215C or higher, FW 4.2 or later. The 1212C and 1211C also support the instructions covered, but I/O count is reduced.
- HMI/LOGO!: LOGO! 8 FS4 (0BA8.Standard, 6ED1052-1xx08-0BA1 family, or 0BA8.S.E). FS4 is required for full S7-connection compatibility in TIA Portal V15. Earlier LOGO! 8 variants (FS1–FS3) are not selectable in TIA Portal V15 project trees.
- Engineering tool: TIA Portal V15.0 or V15.1 with the LOGO! 8 FS4 HSP (Hardware Support Package). Without the HSP the LOGO! device is created as "LOGO! 8 (compatible)" which limits connection diagnostics.
- Network: Industrial wireless Ethernet bridge (e.g., SCALANCE W or third-party 5 GHz). Both radios must be in bridge mode; one radio per side is sufficient. Watch for MAC-layer broadcast behavior on wireless links — see Section 4.
- IP scheme: S7-1200 in the same subnet as LOGO! 8, e.g., 192.168.0.1 (PLC) and 192.168.0.2 (LOGO!). Subnet mask 255.255.255.0.
2. Communication Architecture
The S7-1200 acts as the active partner (S7 client) and the LOGO! 8 acts as the S7 server. Three transport options are available in TIA Portal:
| Transport | Instructions on S7-1200 | LOGO! role | Diagnostic access |
|---|---|---|---|
| S7 connection (PUT/GET) | PUT, GET (single or multi) | S7 server, TSAP 02.01 default | STATUS output of PUT/GET; no T_DIAG for S7 connections |
| Open TCP (TCON/TSEND/TRCV) | TCON, TSEND, TRCV, TDISCON, T_DIAG | TCP server, port 102 or 8080 | STATUS outputs; T_DIAG CONN_STATE |
| Modbus TCP | MB_CLIENT, MB_SERVER | Modbus TCP server | MB_CLIENT.DONE/ERROR |
T_DIAG applies only to Open User Communication (TCON/TSEND/TRCV) over TCP. If the project uses S7 PUT/GET, switch to TCP to use T_DIAG, or use a life-bit in parallel for full coverage.
2.1 Topology diagram (textual)
[ S7-1200 CPU 1215C, FW 4.2 ] [ LOGO! 8 FS4 ] IP 192.168.0.1 IP 192.168.0.2 PROFINET port 0 <----- wireless bridge radio A ----- wireless bridge radio B ----- PROFINET port TCON ID 1 (TCP, port 8080, partner 192.168.0.2) S7/TCP server
3. Method 1 — T_DIAG Instruction in the S7-1200
T_DIAG is the diagnostic block in TIA Portal for an Open User Communication connection. The instruction reads the state of a connection established with TCON and returns a connection state code at the CONN_STATE output.
3.1 T_DIAG block parameters
| Parameter | Direction | Type | Description |
|---|---|---|---|
| REQ | Input | BOOL | Rising edge triggers a diagnostic query |
| ID | Input | WORD/INT | Connection ID from TCON, e.g., W#16#1 |
| MODE | Input | INT | 0 = query connection state; 1 = query detailed diagnostic |
| DONE | Output | BOOL | TRUE when query has completed |
| BUSY | Output | BOOL | TRUE while query is in progress |
| ERROR | Output | BOOL | TRUE if the query itself failed (e.g., wrong ID) |
| STATUS | Output | WORD | Block-level status word (see Section 6) |
| CONN_STATE | Output | WORD | 0 = down, 1 = establishing, 2 = established, 3 = terminating, 4 = error |
3.2 Typical call in SCL (Structured Control Language)
// OB1 "Main" - call T_DIAG once per 250 ms from a cyclic interrupt OB
// or a clock memory bit (e.g., M0.5 = 200 ms) for diagnostic polling
IF "Clock_200ms" THEN
"T_DIAG_DB".REQ := TRUE; // request diagnostic query
"T_DIAG_DB".ID := W#16#0001; // same ID used in TCON
"T_DIAG_DB".MODE := 0; // 0 = basic connection state
END_IF;
"T_DIAG_DB"(); // call instruction instance
IF "T_DIAG_DB".DONE AND "T_DIAG_DB".ERROR = FALSE THEN
CASE "T_DIAG_DB".CONN_STATE OF
0: "Comm_Health" := 0; // connection down
1: "Comm_Health" := 1; // establishing
2: "Comm_Health" := 2; // established
3: "Comm_Health" := 3; // terminating
4: "Comm_Health" := 4; // error
END_CASE;
END_IF;
REQ back to FALSE after DONE is set, otherwise the instruction will not re-trigger on the next clock pulse. Use a small edge detector or an instance data bit.3.3 Ladder equivalent
---|M0.5 (Clock 200ms)---|T_DIAG.DB.REQ--|
ID--W#16#1--|
MODE--INT#0--|
---( T_DIAG )--- // instance call
---|T_DIAG.DB.DONE && NOT T_DIAG.DB.ERROR---|
---|T_DIAG.DB.CONN_STATE == 2---|Comm_Health_OK--( S )---|
---|T_DIAG.DB.CONN_STATE <> 2---|Comm_Health_OK--( R )---|
4. Method 2 — LOGO! Network Input Diagnostic
LOGO! 8 FS4 exposes a per-connection diagnostic icon on the onboard display. The icon appears next to a network input (NI) when the connection to its partner is lost. The same status can be read by the LOGO! program as a special flag, which is the basis of the diagnostic attribute.
4.1 Enable the diagnostic attribute in LOGO! Soft Comfort
- Open the LOGO! project in LOGO! Soft Comfort (V8.2 or later recommended for FS4).
- Drag a Network Input (NI) block from the toolbar (Networking group).
- Open the NI block properties: select the input and click the "Connection" tab.
- Check "Enable diagnostic" (or "Enable diagnostic connection" in localized builds).
- Assign the partner IP, port, and TSAP equivalent for the LOGO! side.
- Download the program to the LOGO! 8.
4.2 Diagnostic result in the LOGO! program
When "Enable diagnostic" is active, the LOGO! exposes a bit that reflects the connection state:
- NI diagnostic OK = connection alive and data is fresh.
- NI diagnostic FAIL = no valid frame received within the LOGO! timeout (default 2 s, configurable per NI block).
Use the diagnostic bit in a LOGO! logic network to drive an output, a message text on the display, or a status bit back to the S7-1200 via a network output (NQ).
// LOGO! FBD example (textual)
NI1 (enable_diag = ON, partner = 192.168.0.1:8080, timeout = 2 s)
---|NI1.OK|--- B001 (AND with run enable)
--- B001 ---| Q1 (display "Comm OK")
NI1 (same connection)
---|NOT NI1.OK|--- B002
--- B002 ---| Q2 (display "LOGO! comm error")
5. Method 3 — Life-Bit (Heartbeat) Exchange
The life-bit is a single bit (or a counter that increments every cycle) that is sent on every scan from the active partner to the passive partner. The passive partner watches the bit; if the bit does not change state for more than a defined watchdog time, an error is raised.
5.1 Design
| Direction | Bit location | Update rate | Watchdog (LOGO! side) | Watchdog (S7-1200 side) |
|---|---|---|---|---|
| PLC → LOGO! | DB1.DBX0.0 (LifeBit_PLC) | 100 ms (toggle in OB1) | 300 ms off-state time-out | n/a |
| LOGO! → PLC | Network output bit 1 → DB1.DBX0.1 (LifeBit_LOGO) | 500 ms (toggle in LOGO!) | n/a | 1.5 s no-change alarm |
5.2 S7-1200 life-bit generation (SCL)
// OB1 - toggle PLC life-bit every 100 ms using clock memory
IF "Clock_100ms" THEN
"Data_to_LOGO".LifeBit_PLC := NOT "Data_to_LOGO".LifeBit_PLC;
END_IF;
5.3 S7-1200 life-bit supervision (SCL)
// OB35 / OB1 - supervise incoming LOGO! life-bit
"LifeBit_Time" := "LifeBit_Time" + 1; // increment each cycle
IF "Data_from_LOGO".LifeBit_LOGO <> "LifeBit_Prev" THEN
"LifeBit_Time" := 0; // reset watchdog
"LifeBit_Prev" := "Data_from_LOGO".LifeBit_LOGO;
END_IF;
IF "LifeBit_Time" > 15 THEN // 15 * 100 ms = 1.5 s
"Comm_Health" := 0; // 0 = failure
"Comm_Fault" := TRUE;
ELSE
"Comm_Fault" := FALSE;
END_IF;
5.4 LOGO! life-bit supervision (FBD pseudo-code)
- Read the network input bit assigned to
LifeBit_PLCinto a marker M1. - Use an on-delay / off-delay timer (max 300 ms) to require the bit to change at least every 300 ms.
- If the timer expires, set the Q2 display message "Com lost to PLC".
6. STATUS Code Reference for TCON / TSEND / TRCV / T_DIAG
When ERROR is TRUE on any Open User Communication block, read the STATUS word. The high byte is the general error class; the low byte is the detailed code.
| STATUS (hex) | Block | Meaning | Field action |
|---|---|---|---|
| 0000 | All | Job completed without error | Continue |
| 7000 | TSEND/TRCV | No job active | Continue |
| 7001 | TSEND | Job started, send in progress | Wait |
| 7002 | TRCV | Receive job in progress, no data yet | Wait |
| 7003 | All | Job aborted (e.g., by TDISCON) | Re-evaluate cycle |
| 80A1 | TCON | Connection or port already in use | Check ID/port uniqueness |
| 80A3 | TCON | Connection being terminated | Re-issue TCON after TDISCON |
| 80A7 | TCON | Internal resource error | CPU restart, check firmware |
| 80B1 | TCON | Protocol variant invalid | Check connection type in DB |
| 8085 | All | Parameter assignment error | Check block instance DB length |
| 80C3 | TCON | IP address/port of partner not reachable | Verify IP, ping from PLC Web server |
| 80C4 | TSEND | Temporary communications error | Auto-retry, no action |
| 80C5 | TSEND | Remote partner has terminated connection | LOGO! reboot or T_DIAG shows 4 |
6.1 CONN_STATE codes (T_DIAG MODE 0)
| CONN_STATE | Meaning |
|---|---|
| 0 | Connection not established / down |
| 1 | Connection being established (TCP handshake) |
| 2 | Connection established (healthy) |
| 3 | Connection being terminated |
| 4 | Connection in error |
ID does not match an existing TCON instance, or the instance DB is shared with another instruction. Verify in the project tree under "Program blocks > System blocks > Connection resources".7. TIA Portal V15 Configuration Procedure
- Add the LOGO! 8 FS4 device. In the project tree, "Add new device > LOGO! 8 > LOGO! 8 FS4" and assign IP 192.168.0.2. The FS4 must be present in the catalog; if not, install the LOGO! 8 HSP (HSP0230 or equivalent) via TIA Portal's "Options > Support Packages".
- Configure the S7-1200 PROFINET interface. Open the CPU, "Properties > PROFINET interface > Ethernet addresses". Set IP 192.168.0.1, subnet 255.255.255.0, enable "Use router" only if needed.
-
Create an Open User Communication (TCP) connection. In the S7-1200 device tree, "Properties > General > Open User Communication". Add a new connection with:
- Connection type: TCP
- Partner IP: 192.168.0.2
- Partner port: 8080 (or any free port)
- Local port: 0 (any)
- Connection ID: 1
- Connection name: "PLC_to_LOGO_TCP" - Add the TCON, TSEND, TRCV, T_DIAG blocks in OB1. Each must reference the same connection ID (1). Generate the instance DBs when prompted.
-
Define the data block for process data (e.g., DB1 with 16 bytes each direction). Include a
LifeBit_PLCBOOL at offset 0.0 for Method 3. - Compile and download the S7-1200 project. Watch the online view of the connection in "Online & Diagnostics > PROFINET interface > Connection diagnostics".
- Go online with the LOGO! 8 in TIA Portal (or LOGO! Soft Comfort) and verify the connection resources page lists the S7-1200 as a partner.
8. LOGO! Soft Comfort Configuration Procedure
- Open the LOGO! project and switch to the "Network Project" view ("Tools > Ethernet > Network Project").
- Add an Ethernet connection: type = S7/TCP, partner = 192.168.0.1:8080, own TSAP 02.01.
- From the "Network Inputs" palette, drag the receive bytes into the FBD diagram. Map byte 0 to the bits that include
LifeBit_PLC. - Add a Network Output (NQ) and assign it the LOGO!-to-PLC data block, including
LifeBit_LOGO. - Right-click the Network Input > Properties > enable "Diagnostic". Set the diagnostic timeout to a value greater than 2x the PLC scan period (e.g., 300 ms for a 100 ms toggle).
- Compile and download the LOGO! project. The LOGO! display will now show a small icon next to each NI when the link is healthy.
9. Verification Procedure
After commissioning, prove the diagnostic logic by injecting a real link fault:
- Establish the link, confirm
Comm_Health = 2(established) and the LOGO! display shows no diagnostic icon. - Power down the LOGO! 8. Observe:
- S7-1200: T_DIAG.CONN_STATE transitions 2 → 4 (error) within ~1 s.
- TSEND.STATUS returns 80C5 (partner terminated).
- PLCComm_Faulttag = TRUE within the watchdog time (1.5 s for the life-bit). - Power the LOGO! back up. Confirm CONN_STATE returns to 2,
Comm_Faultclears, and HMI shows "OK". - Repeat with the wireless bridge powered off. Wireless faults typically take 3–8 s to surface (link layer timeout). The life-bit will catch this even if the IP-layer T_DIAG cycles briefly report CONN_STATE 2.
- Disconnect only the antenna on the LOGO! side. Expect CONN_STATE = 0, the LOGO! NI diagnostic icon to appear, and an HMI alarm within the configured 300 ms + 1.5 s window.
10. Troubleshooting Matrix
| Symptom | Likely cause | Check | Fix |
|---|---|---|---|
| T_DIAG.DONE always FALSE, BUSY = FALSE | Wrong ID, or instance DB not loaded | Online > Connection resources | Match ID to TCON; recompile and download all blocks |
| CONN_STATE stays at 1 | TCP handshake not completing | Ping LOGO! from Web server; check firewall on partner | Verify partner port; LOGO! must be passive |
| CONN_STATE = 2 but data is stale | Half-duplex wireless link losing TX only | Look for retries on the bridge | Enable 802.11n SISO; reduce multicast |
| CONN_STATE = 2, life-bit never toggles | TSEND not actually called in OB1 | Online watch TSEND.REQ / TSEND.BUSY | Wire TSEND.REQ to a clock bit |
| LOGO! NI diagnostic icon blinks but T_DIAG says 2 | LOGO! timeout set too short, or PLC scan > timeout | Check NI timeout in LOGO! Soft Comfort | Set NI timeout > 2x PLC scan |
| Wireless bridge works for hours, then alarms | Spanning tree / broadcast storm on bridge | Bridge log | Disable STP on the bridge, set static link |
| PUT/GET works but T_DIAG returns 8085 | T_DIAG only works on TCON-handled connections | Inspect block type | Switch to TCP/IP or use PUT/GET STATUS instead |
| LOGO! 0BA8 (non-FS4) is in the project | FS4 HSP not installed | Options > Support Packages | Install HSP, replace device, recompile |
11. Field-Proven Caveats
- Wireless bridge asymmetry. Bridges can keep the MAC link up for several seconds after the IP layer is unreachable. T_DIAG reacts to TCP state, which converges faster (typically 1–2 s). The life-bit is the only one of the three that catches "MAC up, IP broken" cases deterministically.
- LOGO! 0BA8 FS4 firmware ≥ 1.81.01 is required for stable S7 communication. Earlier 0BA8 firmware versions accepted the configuration but dropped connections under load. Update with LOGO! Soft Comfort V8.2 or later.
- S7-1200 FW 4.2 + TIA Portal V15.1 is the lowest recommended combination for T_DIAG. V15.0 + FW 4.2 supports the instruction but lacks the online diagnostic enhancements that V15.1 adds to the connection resources view.
- Cycle-time coupling. The life-bit watchdog must be at least 2x the slower side's cycle. For a 100 ms toggle, the watchdog should be ≥ 300 ms. Using a 100 ms watchdog with a 100 ms toggle causes nuisance trips when the cycle slips.
-
HMI mapping. An HMI tag wired to
Comm_Healthin TIA Portal will inherit the value automatically. If the HMI is on the same wireless bridge, expect 1–2 screen-refresh cycles of latency before the alarm visibly updates.
12. Reference Documentation
For the authoritative procedure to navigate the LOGO! 8 built-in diagnostics menu, see the Siemens support article Diagnosing errors from LOGO! - LOGO! - ID: 109741041 - Support. This page documents the on-device diagnostic flow shown on the LOGO! display when an Ethernet connection is lost, including the menu path ① → ② → OK for software errors and the network diagnostic icon locations.
What is the simplest way to surface a lost connection in the LOGO! display?
Enable the "Diagnostic" attribute on the Network Input block in LOGO! Soft Comfort. The LOGO! 8 will show a connection-state icon next to each NI. Drive a display message text from the diagnostic bit to give the operator a plain-language alarm.
Why does T_DIAG return DONE = FALSE on a S7-1200 FW 4.2?
The most common cause is a mismatched connection ID. T_DIAG must reference the same ID (e.g., W#16#1) used by the TCON block. Verify the ID under "Program blocks > System blocks > Connection resources" in TIA Portal. A secondary cause is T_DIAG being called on an S7 PUT/GET connection, which is not supported — switch to Open User Communication (TCP).
Can I detect a fault if only the wireless bridge is down?
Yes — but only the life-bit method reacts within the 3–8 s MAC-layer time-out. T_DIAG and the LOGO! NI diagnostic both depend on TCP/IP and may not transition until the bridge releases the link. Use a life-bit toggle of 100 ms and a watchdog of 1.5 s on the S7-1200 side.
Do I need LOGO! 8 FS4 specifically, or does FS3 work?
FS4 is required for the full TIA Portal V15 S7 connection integration and for the network input diagnostic attribute. FS3 can communicate with the S7-1200, but the project will be created as "LOGO! 8 (compatible)" and the diagnostic bits are not exposed in the same way.
Which TIA Portal version first supported T_DIAG on the S7-1200?
T_DIAG is part of the Open User Communication instruction set and is supported on S7-1200 CPUs with firmware 4.2 or later, project-engineered with TIA Portal V15.0 or newer. TIA Portal V15.1 adds enhanced online diagnostic pages; V16 is recommended for new projects.