Resolving S7-1500 TCON Socket Not Opening: Status 7002 Fix

David Krause15 min read
SiemensTIA PortalTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Resolving Siemens S7-1500 TCON Socket Not Opening: Status 7002 BUSY Diagnostic and Fix

Symptom: TCON on a Siemens SIMATIC S7-1500 (CPU 1515-2 PN or comparable) never opens the TCP socket. The block output shows BUSY = TRUE with no ERROR bit, and the STATUS word returns hex 7002. External tools such as Sockettest, netcat, or a custom PC server cannot reach the PLC, and the partner application reports that the CPU is unreachable on the configured port.

Root cause: The connection establishment direction in the configured connection is set opposite to the role the PLC must play. Status 7002 is the normal "waiting for the active partner to call" state, not a fault. The block is behaving correctly; the configuration is wrong.

Engineering takeaway: A TCON block that reports BUSY without ERROR is not broken. It is a state-machine output. Treat 7002 as a configuration hint, not a defect. Re-read the connection establishment field before touching the code.

1. TCON Block Fundamentals on the S7-1500

TCON ("Open communication connection") belongs to the family of Open User Communication (OUC) instructions available in the S7-1200 and S7-1500 instruction set. TIA Portal groups it with TDISCON, TSEND, TRCV, TUSEND, and TURCV under Communications > Open User Communication. TCON allocates the local socket resources, resolves the connection description (ID, type, partner address, port), and either dials out (active) or listens (passive) depending on the connection establishment direction stored in the connection data block.

On the S7-1500, TCON supports four protocol variants selected by connection_type in the connection DB:

connection_type Protocol Default port Typical use
16#0B (11) TCP (IPv4) User-defined, e.g. 2000, 3000, 5000 Generic server/client sockets
16#0C (12) ISO-on-TCP (RFC 1006) 102 SIMATIC S7-to-S7 and S7-to-PC with S7 protocol
16#0E (14) UDP User-defined Connectionless datagrams (pair with TUSEND/TURCV)
16#0F (15) TCP (IPv6) User-defined IPv6 server/client sockets

Each TCON instance is tied to a single connection description stored in a global data block of type TCON_Param (or the system-generated TCON_Configured_Connection_DB when configured via the wizard). The PLC must have an active PROFINET interface with a valid IP address on the same subnet or routable to the partner.

2. Active vs Passive Connection Establishment

The most misunderstood field on a TCON connection is "Connection establishment" in the connection properties. It controls who initiates the TCP three-way handshake:

  • Active (local initiates): The PLC performs connect(). The CPU is the TCP client. The block transitions out of 7002 toward 7000 (idle/established) as soon as the partner accepts the SYN.
  • Passive (partner initiates): The PLC performs bind() + listen(). The CPU is the TCP server. The block stays in 7002 until the remote client sends a SYN to the configured port. The block never calls connect(); it only accepts incoming SYNs.

In the client/server model, the client is always the active endpoint. The server is always the passive endpoint. This is the rule the Siemens TIA Portal wizard enforces implicitly through the connection establishment field. Setting the CPU as passive while expecting it to be the "client" guarantees that 7002 will persist indefinitely.

PLC (S7-1500) TCON: connection_type = 0x0B (TCP) Active: PLC calls connect() Passive: PLC calls listen() Block state: 7002 while waiting S7-1500 CPU 1515-2 PN PC / Partner Server port: 2000 Acts as server (passive) Or as client (active) Sockettest / netcat / App SYN / SYN-ACK / ACK

The directional rule is universal: the side that calls connect() is active; the side that calls accept() (after listen()) is passive. Both sides cannot be active, and both sides cannot be passive. A common operator error is to declare both ends "passive" because the term sounds like "the safer choice"; in TCP semantics, passive means it accepts, not that it polls.

3. Decoding Status 7002 on TCON

On S7-1500 firmware V2.0 and later (TIA Portal V13 SP1 and newer), TCON returns a 16-bit status code in the STATUS output and updates the STATE field of the connection DB. Status 7002 (hex) is the standard "connection establishment in progress" state. The mapping is documented in the TIA Portal help for the TCON instruction and in the system diagnostics buffer reference.

STATUS (hex) STATE Meaning Action
0000 0 Connection not yet initialized Call TCON once with REQ = TRUE
7000 3 Connection established, idle Ready for TSEND/TRCV
7001 1 Connection establishment started Wait; do not call TCON again
7002 2 Connection establishment in progress / waiting for partner Wait for SYN if passive; check partner if active and persistent
7003 4 Connection termination started Wait for TDISCON to complete
7004 5 Connection terminated / idle, ready for new TCON Call TCON to reopen

If the STATUS field reads 7002 indefinitely with ERROR = FALSE, the TCON state machine is parked in STATE = 2. There is nothing to "fix" inside the block. The fix is in the project configuration or in the partner application.

Diagnostic tip: In TIA Portal, open the connection DB and read STATE and STATE_BYTE online with the watch table. State 2 with no ERROR is a 7002 hang. If STATE is 0 with no error, TCON was never triggered (REQ not seen or wrong connection ID).

4. Root Cause Analysis: Why the Socket Will Not Open

Counting from the most common to the least common, the following causes account for nearly every TCON 7002 case on the S7-1500:

  1. Direction mismatch (most common): PLC set as passive while the partner PC server is also passive, or PLC set as active while no PC is listening. Status 7002 persists because no one is calling.
  2. Partner is not in LISTEN: Confirm the PC server is in listen() state with netstat -an | findstr :2000 on Windows or ss -tlnp | grep 2000 on Linux before calling TCON.
  3. Firewall on the path: Per the official TIA Portal documentation for TCON/TDISCON/TSEND/TRCV, the instruction cannot establish the connection when firewalls on the connection path do not permit the required ports. Siemens TIA Portal: TCON/TDISCON/TSEND/TRCV TCP communication instructions.
  4. Wrong port or partner address: Partner IP/port in the connection DB does not match the listening PC. Wireshark on the PLC port shows SYN retransmits with no response when the partner is unreachable.
  5. Already-established connection reuse (error 80A3): The same connection ID is still bound from a prior session that was not closed with TDISCON. The CPU refuses to re-establish, returning 80A3 ("Attempt being made to re-establish an existing connection"). The PLC must run "Power off $L" or the program must call TDISCON before re-arming TCON.

5. Step-by-Step Resolution Procedure

Apply the following procedure in order. Each step has a binary pass/fail check you can perform online without leaving TIA Portal.

5.1 Prerequisites

  • TIA Portal V15.1 or later recommended; the configuration screens for TCON are functionally identical from V15 onward, and V16/V17/SP2 are equally valid.
  • S7-1500 CPU with PROFINET interface, e.g. CPU 1515-2 PN (article number 6ES7515-2AM02-0AB0) or any current S7-1500 variant running the firmware release bundled with the project.
  • Online connection to the PLC (Ethernet, accessible from the programming PG).
  • Watch table with the connection DB tags STATE, STATE_BYTE, STATUS, plus the TCON instance's BUSY, ERROR, STATUS, and CONNECT.

5.2 Verify the Active/Passive Direction

  1. In the project tree, expand Devices & networks and open the Connections node.
  2. Select the failing TCON connection. The properties dialog shows the General tab with the partners and addresses.
  3. Click the Connection establishment field. Confirm which endpoint is set as Active and which is Passive.
  4. Cross-check the role expected by the partner application:
    • If the PC is a server (listening), the PLC must be the Active endpoint that calls connect().
    • If the PC is a client (initiates), the PLC must be the Passive endpoint in listen().
  5. If the setting is reversed, change the active endpoint in the dropdown and recompile + download only the connection data. A full hardware download is not required for connection DB changes.

5.3 Confirm the Partner Is Reachable

  1. From the PG/PC connected to the same subnet, ping the PLC IP and ping the partner IP.
  2. From the PG/PC, run telnet <plc_ip> <port>. A "Connecting to ..." message that resolves to a blank screen means the PLC is in listen() (passive). A "Could not open connection" message means the PLC is not listening at all, which is correct for active mode.
  3. From the partner PC, run netstat -an (Windows) or ss -tln (Linux) and confirm the partner is in LISTEN state on the configured port.

5.4 Inspect the Online Status and Force a Fresh TCON

  1. Open the watch table and force the TCON instance's REQ to FALSE, then back to TRUE. The instance must be triggered with a rising edge.
  2. Monitor the instance's STATUS:
    • 7000 with CONNECT = TRUE: socket is open. The bug is in the partner side.
    • 7001 / 7002: state machine in progress; wait a few seconds.
    • 80A3: connection ID already in use. Run a one-shot "Reset connection" routine that calls TDISCON, waits one OB1 cycle, then TCON.
    • 80A1, 80A2, 80A4, 80A7, 80AA, 80B0, 80B1, 80C3, 80C4: classify with the table in section 8.
  3. If 80A3 persists across power cycles, issue "Power off $L" in the online menu (CPU STOP/RUN does not clear TCON state on every firmware; only a real power cycle or STOP with memory reset clears the internal connection descriptor on older builds).
Important: Error 80A3 ("Attempt being made to re-establish an existing connection") is a known behavior on S7-1500 when the user program calls TCON twice in quick succession or fails to honor a TDISCON cycle. Always gate TCON behind a one-shot rising-edge detector and only call it when CONNECT = FALSE AND STATE is 0 or 4.

6. Configuration Parameters Reference

The connection DB (type TCON_Param) contains the fields that determine the runtime behavior. The wizard pre-fills most of them. The fields that must match the partner exactly are listed below.

Field Type Meaning Common fault
BlockParam.id WORD Connection ID, 1..4095, must be unique per CPU Duplicate ID with another TCON/TSEND
BlockParam.connection_type BYTE 0x0B TCPv4, 0x0C ISO-on-TCP, 0x0E UDP, 0x0F TCPv6 Wrong type for partner protocol
BlockParam.active_est BOOL TRUE = PLC is active (client), FALSE = PLC is passive (server) Root cause of 7002
BlockParam.local_device_id BYTE Local interface index, 1 = PN/IE interface Wrong index for a CP/CM module
BlockParam.local_tsap_id_len / local_tsap_id BYTE / BYTE[16] For ISO-on-TCP, the local TSAP; for TCP, often blank TSAP length > 16 or malformed
BlockParam.rem_subnet_id_len BYTE Length of remote subnet ID string Set to 0 for direct IP
BlockParam.rem_subnet_id BYTE[6] Router address bytes 1..4 (IPv4), 0 for local subnet Wrong router IP
BlockParam.rem_staddr_len BYTE Length of remote IP, 4 for IPv4 0 means no address; TCON waits forever
BlockParam.rem_staddr BYTE[16] Remote IPv4 in network byte order (bytes 0..3 used) Byte order / endian swap
BlockParam.rem_tsap_id_len / rem_tsap_id BYTE / BYTE[16] Remote TSAP or port (big endian for TCP port) Port in little endian when partner expects big endian

For TCP connections, the remote port is stored in rem_tsap_id[0..1] as a big-endian 16-bit unsigned integer. Port 2000 is stored as bytes 0x07, 0xD0. Writing 0xD0, 0x07 makes the CPU dial port 0xD007 = 53255 instead of 2000 and produces 7002 followed by 80A4 or 80C3.

7. Firewall and Port Requirements

Per the official Siemens TIA Portal documentation for the TCON/TDISCON/TSEND/TRCV instruction group, the instruction cannot establish the connection when the firewalls on the connection path are not open for the required ports. Siemens TIA Portal: TCON/TDISCON/TSEND/TRCV TCP communication instructions. The minimum set of open ports for OUC on a CPU 1515-2 PN is:

  • 102/TCP for ISO-on-TCP (default; configurable in connection DB).
  • User port (e.g. 2000, 2001, 2002) for plain TCP OUC; one port per concurrent TCON.
  • PROFINET discovery ports (UDP) used for engineering download and topology discovery.
  • 102/TCP and the S7 communication port range (typically 50000..50100/TCP) on the PLC for S7 PUT/GET used by HMI panels (separate from TCON).

On Windows partners, create an inbound rule allowing the listening port of the server. On the PLC side, the integrated firewall (available on CPU 150xS / 1518 and licensed through the Security module) must allow the local port of the active connection or any port for the passive role. On a CPU 1515-2 PN without the Security module, the perimeter firewall is the controlling element and the integrated firewall is not in the path.

8. TCON Error Code Reference

The TCON instruction surfaces the following status codes. Error codes are returned in the STATUS output; transient codes (7xxx) indicate progress, permanent codes (8xxx) indicate faults.

STATUS (hex) Class Meaning Operator action
0000 OK No fault, idle None
7000 Progress Connection idle, established Use TSEND/TRCV
7001 Progress Establishment started Wait
7002 Progress Establishment in progress / waiting for partner Verify direction; wait for SYN if passive
7003 Progress Termination started Wait for TDISCON done
7004 Progress Terminated, idle, ready for new TCON Call TCON again
80A0 Error Same ID in use, or ID syntax wrong Reassign ID, recompile
80A1 Error Connection or port already occupied TDISCON, wait, TCON
80A2 Error Local resource error (out of sockets) Reduce concurrent TCON count
80A3 Error Attempt to re-establish existing connection TDISCON + delayed TCON, or power cycle
80A4 Error IP address of partner invalid Verify rem_staddr in connection DB
80A7 Error TCP/UDP stack not configured or PROFINET interface down Check PN interface online diagnostics
80AA Error Partner refused connection (RST received) Partner not in LISTEN, or wrong port
80B0 Error Passive establishment not supported by partner Set PLC as active, partner as server
80B1 Error Active establishment not supported by partner Set PLC as passive, partner as client
80C3 Error All connection resources in use Reduce TCON count below CPU maximum
80C4 Error Temporary resource error, transport layer busy Retry with backoff; check CPU load
Error code 80A3 nuance: The S7-1500 keeps the connection descriptor in the connection DB across STOP/RUN transitions. STOP alone does not free the TCP socket; it only marks the state for cleanup at the next startup. If the partner holds the half-open socket and the PLC attempts TCON again immediately, the CPU returns 80A3. Always gate TCON on a one-shot rising edge and verify the previous TCON call reached STATE = 4 (terminated) before re-arming.

9. Verification Procedure

Once the configuration is corrected, verify the socket is actually open using both PLC-side and PC-side methods.

  1. Online in TIA Portal, open the watch table on the connection DB and confirm:
    • STATE = 3 (connected)
    • TCON instance CONNECT = TRUE
    • TCON instance STATUS = 16#7000
    • TCON instance BUSY = FALSE
    • TCON instance ERROR = FALSE
  2. From the PC, run netstat -an | findstr <port> (Windows) or ss -tn 'sport = :<port>' (Linux). The connection must appear in ESTABLISHED state.
  3. From the PC, send a probe payload with Sockettest / netcat. On the PLC, monitor LEN on the TRCV instance; it must rise to the payload length and NDR must pulse for one cycle.
  4. Issue TSEND with a 4-byte identification string. The PC must receive the bytes in the correct order (the S7-1500 TCP is big-endian for INT/DWORD and little-endian for STRING; verify with a sentinel byte pattern such as 0xDE 0xAD 0xBE 0xEF).

If STATE = 3 is reached but the PC sees no SYN, the partner is blocking the response or a stateful firewall is dropping the return SYN-ACK. Enable Wireshark on the PLC port and confirm a full three-way handshake completes in under 1 second.

10. State Machine Diagram (Inline)

STATE 0 idle, never opened STATE 1 REQ rising edge STATE 2 (7002) waiting for partner STATE 3 (7000) ESTABLISHED, CONNECT=TRUE STATE 4 (7004) TDISCON done, ready REQ SYN-ACK received (active) or partner SYN (passive) TDISCON FIN/ACK or RST

11. Field Commissioning Checklist

Use this checklist on every new TCON connection before declaring it production-ready.

  1. Confirm partner IP reachable: ping from PLC engineering port returns <1 ms on the local subnet.
  2. Confirm partner port in LISTEN: ss -tln | grep <port> on the partner host.
  3. Confirm PLC interface is in RUN with no PROFINET diagnostics: Online & diagnostics > PROFINET interface > Port statistics.
  4. Confirm connection direction matches the application: PLC active for a PC server, PLC passive for a PC client.
  5. Trigger TCON with a one-shot rising edge; verify STATE = 3, STATUS = 7000, CONNECT = TRUE within 5 seconds on a local subnet.
  6. Run a TSEND of 4 bytes 0xDE 0xAD 0xBE 0xEF; confirm arrival on the PC byte-for-byte.
  7. Run a TRCV of the same 4 bytes echoed back; confirm LEN = 4 and NDR pulses for one cycle.
  8. Run TDISCON; verify STATE = 4, STATUS = 7004, CONNECT = FALSE within 2 seconds.
  9. Cycle the PLC to STOP and back to RUN; confirm the connection is re-established automatically if the program calls TCON on startup, or remains closed if gated on a handshake from the partner.
  10. Document the connection ID, port, direction, and partner IP in the project handoff packet.

12. Frequently Asked Questions

Why does TCON show BUSY = TRUE and ERROR = FALSE with status 7002 even though the PC server is running?

The PLC is configured as the passive endpoint (active_est = FALSE) and is in listen(), waiting for a SYN from the PC. If the PC server is also passive, both ends wait forever. Flip the connection establishment direction so that the side that is supposed to dial (typically the PLC when paired with a PC server) is set to Active; status will then transition 7001 -> 7002 -> 7000 within a second.

What does error 80A3 mean and how do I clear it on a CPU 1515-2 PN?

Error 80A3 ("Attempt being made to re-establish an existing connection") means the TCON instance is being called while the previous TCP session is still considered open by the CPU. Insert a one-shot gate: only call TCON when CONNECT = FALSE AND STATE is 0 or 4, and call TDISCON first if STATE is 2 or 3. If the state machine is stuck, perform a STOP -> MRES -> RUN cycle or "Power off $L" in the online menu.

Is port 102 required for TCON, or is it only for S7 communication?

Port 102/TCP is the default for ISO-on-TCP (connection_type = 0x0C). For plain TCP OUC (connection_type = 0x0B), you can use any unprivileged port above 1024. The PLC uses 102/TCP for S7 PUT/GET and for HMI panels independently of TCON; TCON does not reserve port 102 unless you explicitly set rem_tsap_id to 0x00, 0x66.

Can I run more than one TCON on the same S7-1500 interface?

Yes. The S7-1500 supports multiple concurrent TCON instances per PROFINET/IE interface; consult the CPU-specific manual for the exact maximum. Each instance must use a unique connection ID (1..4095) and, for active connections, a unique local port. Reaching the limit produces error 80A2 or 80C3.

Does TCON on S7-1500 support IPv6?

Yes, with connection_type = 0x0F (TCPv6). The remote address goes in rem_staddr bytes 0..15 in network byte order, and rem_staddr_len must be 16. Mixing IPv4 and IPv6 in the same DB is not supported; build separate connection DBs per address family.

Back to blog