Troubleshooting S7-1200 Modbus TCP MB_CLIENT BUSY Lock Issue

David Krause12 min read
S7-1200SiemensTroubleshooting
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

Problem Description

An S7-1200 CPU drives the MB_CLIENT instruction against an Iskra MC740 power meter over the PROFINET interface using TIA Portal V11 SP2 Update5. When the application sets the REQ input, BUSY latches to 1 but neither DONE nor ERROR ever transitions to 1. The instruction appears "stuck" and the read data never populates the configured buffer (MB_DATA_PTR). The same CPU, project, and instruction handle other Modbus TCP endpoints normally, which isolates the fault to the partner device, the connection parameters that target it, or the firmware/library version mismatch.

Root Cause Analysis

According to the Siemens application note for Modbus TCP on S7-1200 and S7-1500 CPUs, MB_CLIENT drives BUSY during both the TCP connection establishment phase and the active request/response phase. DONE is set only after a valid Modbus response PDU has been received and parsed. ERROR is set only when the instruction either receives a Modbus exception code (function code with bit 7 set) or detects a transport-layer fault and reports it through the STATUS output.

If MB_CLIENT shows BUSY=1 for an abnormally long time without ERROR being set, the most likely cause is that the TCP connection is in the SYN-SENT state and the partner has not completed the three-way handshake. The S7-1200 TCP/IP stack retries the SYN according to its internal connect-retry policy, but if no SYN-ACK is ever returned and no TCP RST is received, the connection stays half-open and the STATUS output remains at the queued value 16#7001. This maps directly to the behavior described in the field report: the instruction tries repeatedly to open TCP/502 against the meter and never reaches a state where a Modbus PDU can be exchanged.

The S7-1200 Modbus TCP example set in the TIA Portal manual collection assumes the partner is a Modbus TCP server. The Iskra MC740 is, in many shipped configurations, a Modbus RTU / DNP3 meter with RS-485 and optional Ethernet for DNP3 over TCP, not Modbus TCP. Where Modbus TCP is offered, it is typically a firmware option or a different model variant. Treat protocol support on the meter as unknown until the manual confirms a TCP/502 listener service.

Pre-Diagnostic Verification

Before changing any PLC code, verify the partner device independently. None of these steps require the S7-1200.

  1. Confirm the meter variant and the protocol the firmware exposes. Read the type plate (P/N, HW rev, SW rev). Compare to the Iskra MC740 user manual for the protocol capability matrix.
  2. Apply the meter's documented IP address to a service laptop with a static address on the same subnet. Use a crossover cable or a managed switch with a port-mirror enabled.
  3. Ping the meter. A successful ICMP echo proves Layer 3 reachability only; it does not prove a TCP/502 listener exists. A failed ping immediately rules out Layer 1/2/3 faults.
  4. Probe port 502 with a generic TCP test tool (Hercules SETUP utility in TCP Client mode, Wireshark with the filter tcp.port==502, or PowerShell Test-NetConnection -Port 502). Send a single Modbus Read Holding Registers PDU, for example FC03 starting at register 0, length 1: 00 01 00 00 00 06 01 03 00 00 00 01 (no CRC for TCP). A successful reply proves the meter is a Modbus TCP server. A SYN without any reply, or with an immediate RST, proves the meter is not.
  5. Capture traffic on the mirror port for one REQ cycle from the S7-1200 and verify whether the CPU emits SYN packets to meter:502 at all. No SYN packets mean MB_CLIENT has not attempted the connect (trigger path or instance DB issue). SYN packets without any reply mean the partner is not responding.
Critical: Never trust the meter's datasheet alone for the protocol. Confirm with an external TCP test against TCP/502 before changing any PLC code. The most common root cause for a stuck MB_CLIENT on the MC740 is that the meter is Modbus RTU only.

Protocol Confirmation for Iskra MC740

The MC740 family supports several communication options that depend on the hardware revision and firmware build:

  • Modbus RTU over RS-485 (default on many units).
  • DNP3 over serial or over TCP.
  • Modbus TCP/IP on selected MC740N variants or where an external Ethernet gateway is fitted.

If the unit at hand is the base MC740 with no optional Ethernet module, Modbus TCP is not available and the stuck-on-BUSY symptom is expected: the S7-1200 is sending SYN to a port that is closed. The remedy in that case is one of:

  • Replace MB_CLIENT with a serial Modbus RTU master on a CM 1241 RS-485 module using the MB_COMM_LOAD and MB_MASTER instruction pair.
  • Install the Iskra Ethernet module that exposes TCP/502 and re-test with the Modbus scanner tool.
  • Place a third-party Modbus TCP-to-RTU gateway in front of the MC740 RS-485 port and point MB_CLIENT at the gateway IP.

MB_CLIENT Parameter Configuration

Once protocol support is confirmed, the MB_CLIENT instance must be wired correctly. The instruction signature has changed between firmware generations. In TIA Portal V11 SP2 Update5 the legacy MB_CLIENT blocks match the S7-1200 firmware V2.x/V3.x signature. Configure the inputs as follows.

Input Type Required Value Notes
REQ BOOL Rising edge from application Edge-triggered; a held TRUE does not trigger a second transaction.
MB_MODE USINT 0 = Read, 1 = Write For a read of holding registers (FC03) use 0.
MB_DATA_ADDR UINT Holding register start address (zero-based Modicon offset) Register 40001 maps to MB_DATA_ADDR=0 with MB_MODE=0. Register 40010 maps to MB_DATA_ADDR=9.
MB_DATA_LEN UINT 1..125 for FC03 Many meters only support a small set (e.g. 1..32). Do not exceed the meter's documented register count.
DONE BOOL Status output Sticky; reset by user code after handling.
BUSY BOOL Status output 1 while the instruction is actively processing.
ERROR BOOL Status output Set on any error; evaluate STATUS at the same scan.
STATUS WORD Status / error code Read on every DONE or ERROR edge.
MB_DATA_PTR VARIANT Pointer to instance DB buffer Must match MB_DATA_LEN count of words.
CONNECT TCON_IP_V4 (or TCON_IP_V4_SEC) Connection description See the next section.

For a read of 8 holding registers starting at Modbus address 40001 from a meter whose IP is 10.0.0.42:


MB_MODE      := 0;                          // 0 = read holding registers
MB_DATA_ADDR := 0;                          // Modbus 40001 (zero offset)
MB_DATA_LEN  := 8;                          // 8 registers
MB_DATA_PTR  := P#DB20.DBX0.0 WORD 8;       // buffer of 8 words

Do not start with a large MB_DATA_LEN "just in case": many entry-class meters reject FC03 reads spanning the entire input map with an Illegal Data Address (0x02) exception. Begin with MB_DATA_LEN = 1 against a known register, then scale upward register-by-register as each register is verified.

TCON_IP_V4 Connection Structure

The CONNECT input is the most common culprit when the connect phase fails silently. In TIA Portal V11 the data block element must be of type TCON_IP_V4 (or the secure variant TCON_IP_V4_SEC on firmware V4.2+). Every field is required and the order is fixed.

Field Type Required Setting Notes
InterfaceId HW_IO HW identifier of the PROFINET port (typically 64 or 65 depending on CPU variant and slot) Verify with "Devices & Networks" -> "Properties" -> "PROFINET interface" -> "Addresses".
ID CONN_OID 1..4095; unique to this MB_CLIENT instance Must not conflict with other TCP connections (HMI, S7, OPC UA).
ConnectionType BYTE 16#0B (11) for TCP UDP is 16#0C; must be 16#0B for Modbus TCP.
ActiveEstablished BOOL TRUE Set FALSE only if a partner initiated the connect (not the case here).
RemoteAddress IP_V4 (ARRAY[1..4] of BYTE) Byte-by-byte meter address, e.g. [10,0,0,42] Use the REMOTE_IP interleave editor in TIA Portal.
RemotePort UINT 502 (Modbus TCP well-known port) Some gateways use 5020 or other non-standard ports.
LocalPort UINT 0 (let the CPU pick) or any unused port above 2000 Avoid reserving a port that a partner uses.
Common errors that produce the BUSY=1 stuck symptom:
  • InterfaceId wrong. The PROFINET port of an S7-1211C is not always 64. Open Devices & Networks, click the CPU, expand "PROFINET interface_1", and read the System Constants (HW identifier). A wrong InterfaceId causes the request to be silently dropped with STATUS=16#8381.
  • RemotePort <> 502. A typo or a leftover value from a previous project leaves the connect pointed at port 0. Always confirm via the watch table.
  • Subnet mask mismatch. The CPU and meter must be on the same IP subnet or routing must be configured on the PROFINET port's gateway parameter. S7-1200 by default uses the IP router only if a gateway is set on the PROFINET interface.
  • LocalPort collision. Two MB_CLIENT instances with the same ID and same LocalPort will race. Assign unique IDs and distinct local ports per instance.

Status Code Reference

Decode the STATUS output at every DONE or ERROR edge. The most relevant values for the S7-1200 firmware V2.x/V3.x generation are:

STATUS (hex) Meaning Recovery action
16#7001 MB_CLIENT waiting for connection establishment Check TCON_IP_V4 fields, partner reachability, InterfaceId.
16#7002 MB_CLIENT waiting for Modbus response Connection is up; partner is silent or wrong MB_DATA_ADDR used.
16#8381 No TCP connection to partner Verify IP, port, firewall, InterfaceId, partner is online.
16#8382 Transport fault on existing connection Reset the instance; investigate line noise, partner reset.
16#8383 Connection aborted by partner (RST) Partner rejected the PDU; verify FC/address/unit ID.
16#8188 Invalid MB_DATA_PTR / wrong data type Reassign buffer to a Word array sized for MB_DATA_LEN.
16#8189 MB_DATA_LEN out of range Reset to 1..125 for FC03.
16#80A1 Modbus exception: Illegal Function Function code not supported by meter.
16#80A2 Modbus exception: Illegal Data Address MB_DATA_ADDR outside the meter's map.
16#80A3 Modbus exception: Illegal Data Value MB_DATA_LEN or value out of range.
16#80A4 Modbus exception: Slave Device Failure Meter internal fault; check meter's diagnostic LEDs.

Capture STATUS via the watch table or trace and verify whether it stays at 16#7001 (connection phase) or advances to 16#7002 (response phase). If STATUS never advances past 16#7001, the partner is not completing the handshake. If it advances to 16#7002 but never reaches DONE, the partner accepted the connection but is not returning a Modbus PDU.

TIA Portal V11 SP2 Caveats and Firmware

Several field-proven issues are specific to the development environment in use:

  • Firmware support: Modbus TCP MB_CLIENT and MB_SERVER instructions require S7-1200 CPU firmware V2.0 or later. Verify the connected CPU's firmware via "Online & Diagnostics" -> "Diagnostic of the CPU". V1.0 firmware does not include the Modbus TCP library and a project that compiles against V11 SP2 will simply not run the FBs at runtime.
  • Library version: TIA Portal V11 SP2 Update5 ships "Modbus_TCP" V13 (master copy 3.1) for the legacy FB_MBUS_CLIENT/FB_MBUS_SERVER FBs. For newer projects prefer "Modbus TCP" V4.x with the renamed MB_CLIENT/MB_SERVER blocks referenced in the S7-1200/S7-1500 Modbus TCP application note. Mixing FBs across versions in the same project is unsupported.
  • Instance DB regeneration: After any change to the CONNECT structure, delete and re-instantiate the MB_CLIENT instance DB. A stale DB keeps the connection descriptor of the previous compile, including an old IP or port.
  • Watchdog supervision in OB1: Running MB_CLIENT only in OB1 with a long cycle is acceptable. Running it only in a watchdog OB or in a time-delay interrupt at a slow rate can stall the TCP stack from completing its state machine.
  • Online STOP/RUN: Each RUN-STOP-RUN cycle closes existing TCP connections. The first REQ after a STOP must wait for the connect phase again; this matches the symptom "first scan fails, subsequent calls also stuck" in some projects.
  • Real-time settings: If the PROFINET port's cycle time is set too low (for example, 1 ms) the communication load can starve the TCP/IP background task, delaying the SYN by several seconds. Increase the PROFINET update time to 2 ms or higher for any S7-1200 that is not engaged in real-time I/O.

Field-Proven Verification Procedure

  1. Bring up the meter's Modbus TCP service. With a service laptop and a Modbus scanner (Modbus Poll, CAS Modbus Scanner, QModMaster), connect to meter.ip:502 and do an FC03 read of register 0 length 1. Confirm a response.
  2. Compile and download the PLC project. After download perform a power cycle if the meter caches the prior client IP.
  3. Force REQ TRUE once. Observe STATUS. Confirm STATUS advances from 16#7001 to 16#7002 within the partner's documented response timeout (typically 2..5 s for an Iskra-class meter).
  4. Observe a successful DONE. Read MB_DATA_PTR in the watch table and verify the values match what the scanner returned.
  5. If the meter is on a different subnet, configure the IP router on the PROFINET interface (Properties -> Ethernet addresses -> IP router). The S7-1200 will route outbound TCP segments to the gateway.
  6. If multiple MB_CLIENT instances target the same meter, assign each a unique CONNECT.ID and a different LocalPort. Verify only one connection is active per instance (use Netstat on a PC mirror).
  7. Disable managed-switch features that interfere with the meter: flow control, energy-efficient Ethernet (EEE / IEEE 802.3az), and IGMP snooping for unknown multicast. Each can break a slow 100BASE-TX endpoint.
  8. Add watch-table breakpoints on DONE, ERROR, and STATUS so every completed or failed transaction leaves a record.

Modbus Address Mapping for the MC740 Family

When the connection is working but DONE never carries the expected values, the cause is typically a wrong MB_DATA_ADDR. The MC740 register map is documented in the Iskra MC740 Modbus protocol reference (P/N 1162530-1). The relevant holding register blocks for a typical energy reading are:

Register address (Modicon) MB_DATA_ADDR (zero-based offset) Quantity
40001 0 Voltage L1 (V * 10)
40003 2 Current L1 (mA)
40015 14 Active power L1 (W)
40255 254 Total active energy (Wh / scale)

Always consult the meter's documentation for the exact register layout and the engineering units, since the scaling factor and endianness are vendor-specific. Most Iskra meters return 32-bit values as a pair of 16-bit registers with the high word first (big-endian within the Modbus payload). Use MB_DATA_LEN counts that respect register pair boundaries to avoid crossing energy counter boundaries mid-read.

Frequently Asked Questions

Why does MB_CLIENT stay at BUSY=1 without ever setting ERROR=1?

The most common cause is that TCP/502 is never reached by the partner: SYN is sent, no SYN-ACK, no RST. STATUS typically reads 16#7001. Verify the meter actually supports Modbus TCP, confirm IP and port 502 with an external scanner, and check that TCON_IP_V4.ActiveEstablished=TRUE, ConnectionType=16#0B, and the InterfaceId matches the PROFINET port in the device configuration.

Does every Iskra MC740 ship with Modbus TCP support?

No. The base MC740 ships with Modbus RTU on RS-485 and DNP3. Modbus TCP requires either the Ethernet-equipped variant or an external Ethernet gateway. Always verify against the type plate and the meter-specific Modbus register map before commissioning.

Which S7-1200 firmware version is required for MB_CLIENT?

MB_CLIENT and MB_SERVER are supported from CPU firmware V2.0 upward. CPU firmware V1.0 does not include the Modbus TCP library. TIA Portal V11 SP2 Update5 targets S7-1200 firmware V2.x/V3.x; for firmware V4.0 and above use the renamed MB_CLIENT/MB_SERVER blocks from the current Modbus TCP library.

What STATUS codes should I expect during normal operation?

Normal sequence: 16#7001 (connection establishment), 16#7002 (waiting for response), then DONE=1 with STATUS=16#0000 on success, or ERROR=1 with a STATUS in the 16#80A0 range for a Modbus exception, 16#8381..16#8383 for transport faults.

Should I prefer MB_CLIENT or the Modbus RTU master with a gateway?

If the MC740 supports Modbus TCP natively, MB_CLIENT is the lowest-effort path. If the unit is Modbus RTU only, fit an S7-1200 CM 1241 RS-485 module and use MB_COMM_LOAD with MB_MASTER, or place a Modbus TCP/RTU gateway in front of the meter's RS-485 port.

Back to blog