IMDHMIControls LibraryShop main store

Troubleshooting

Why two MB_CLIENT instances stop Modbus TCP reads from one server

Industrial networks Published 5 min read

Short answer

Two MB_CLIENT instances each keep their own TCP session to the server, and the FX5U side stops answering when both are enabled. Decode 16#80C5 and 16#80C6 from the working single-instance setup, then read both register groups through one instance with a request sequencer.

On this page
  1. What the two statuses mean
  2. Why one listening port is not the whole story
  3. The checklist that isolates the fault
  4. Sequencing two register groups through one MB_CLIENT for D2708-D2722 and D2804-D2814
  5. If you must run two instances
  6. Questions asked

Two MB_CLIENT instances pointing at the same Modbus TCP server each open their own TCP session, and the FX5U-32 MR/DS in this installation stops serving once the second session appears. The symptoms are repeatable: each register group read fine alone, both together killed the link, and the status then stuck at 16#80C5 with the request active and 16#80C6 with it inactive. The fix is one MB_CLIENT instance with a small request sequencer that reads both ranges, not a second connection.

What the two statuses mean #

Both codes come from the underlying TCON connection handling inside MB_CLIENT V6.0 on a CPU 1515F-2 PN at firmware 3.0, so decode them against the working single-instance configuration, not the register map:

  • 16#80C5: the remote partner has terminated the connection, or an attempt is being made to re-establish a connection that already exists. With two instances, one of them is fighting over a session the other holds or the server has already closed.
  • 16#80C6: a network error; the connection partner cannot be reached. This is the state while the request is inactive and the instance cannot get a session up at all.

The pattern, error on request and network error off request, is what you see when the server side is no longer accepting a new session. The Mitsubishi Ethernet service has a finite number of client sessions and no access to its program was available to change that. The two-week recovery after the cable was unplugged and a new single-instance project was loaded fits a server that releases stale sessions on a long idle timeout, not anything fixed on the Siemens side.

Why one listening port is not the whole story #

A TCP listener on port 502 accepts many connections; each is identified by source address and port, so the port itself does not block a second client. What blocks it is the server implementation: how many simultaneous Modbus sessions the FX5U service permits and how it releases sessions that were not closed cleanly.

The Siemens side adds its own constraints: per the MB_CLIENT documentation for S7-1200 and S7-1500, the connection ID and the instance data block belong together in pairs and must be unique for each connection, and the description of MB_CLIENT requires this pairing. Two instances sharing or mismanaging those pairs fail before the register map matters. You can confirm the exact meaning of each status value in the parameter STATUS reference for MB_CLIENT in the online help of your TIA Portal version. Where the S7 CPU's port also carries PROFINET or S7 traffic, the same single-port reasoning in this article on one PN port carrying both protocols applies.

The checklist that isolates the fault #

Work down this list in order and stop at the first item that changes the status:

  1. Disable the second MB_CLIENT instance completely and confirm the first still fails or recovers. If it recovers only after a long wait, the server was holding stale sessions; that is your answer.
  2. Check that each instance uses its own connection ID with its own instance DB. A duplicated pair gives the re-establish error, not a register error.
  3. Verify the interface: the Modbus connection must go out of the second PROFINET interface, the one addressed in the Mitsubishi network; online access through the first interface proves nothing about the request path.
  4. Confirm link indications at the switch on both PLC-facing ports, then at the Mitsubishi Ethernet port.
  5. Compare the remote address, remote port, connection ID and local-port setting field by field against the configuration that worked. A project rebuild changes them all at once.
  6. With one instance running and the error still present, capture at the Siemens-facing switch port. Repeated SYN with no answer means reachability or an unavailable listener; a reset means rejection by the server; an established session followed by a Modbus exception means the problem is the request or server mapping, which the register gap exception article covers.

The DISCONNECT input and pointing an instance at an empty connection structure only close the Siemens end; they cannot force the server to release its half of a dead session. Only the server's idle timeout or its owner restarting the service does that.

Sequencing two register groups through one MB_CLIENT for D2708-D2722 and D2804-D2814 #

The two ranges are non-contiguous, so one read cannot cover both, but one connection can carry two reads back to back.

Inputs, from the installation:

  • Range A: holding registers D2708 to D2722, 15 registers, data area 16#0001 (holding registers).
  • Range B: holding registers D2804 to D2814, 11 registers.
  • Server: FX5U-32 MR/DS, remote port 502 as configured in the working TCON_IP_v4 structure; one session assumed available.
  • Client: CPU 1515F-2 PN, firmware 3.0, TIA Portal V18.0, MB_CLIENT V6.0.

The rule: one instance, one transaction at a time. Change MB_DATA_ADDR, MB_DATA_LEN, MB_DATA_PTR and the target buffer only while the instruction is idle, start the request on a rising edge of REQ, wait for DONE or ERROR, then advance to the next range.

The arithmetic, one poll cycle per group:

  • Range A length: 2722 - 2708 + 1 = 15 registers.
  • Range B length: 2814 - 2804 + 1 = 11 registers.
  • Per cycle: 2 transactions, 26 registers total, on 1 TCP session.

At a typical Modbus TCP transaction time of a few tens of milliseconds on a healthy link, the full cycle stays well under 200 ms; a poll interval of 1 s for both groups leaves ample margin and matches what the earlier serial-style cyclic polling needs, the same cycle-time arithmetic as in this Modbus RTU polling cycle article.

Decision: keep both destination DBs if the application uses them, delete the second MB_CLIENT instance and its connection structure, and let one sequencer own both reads. The threshold is simple: as long as one server session is all you can rely on, one instance is the design; only add a second concurrent instance after the Mitsubishi configuration owner confirms the enabled Modbus service accepts multiple simultaneous sessions.

If you must run two instances #

Two instances remain a valid architecture only when all three hold: each has a unique connection ID and instance DB pair, the server documentation confirms at least two simultaneous client sessions, and you manage the connection lifetime explicitly instead of relying on request alternation. Alternating requests between two instances does not reduce the session count; both keep their sessions open even with REQ inactive. In this installation, with no access to the server program, none of the three can be verified, so the sequencer is the answer.

Questions asked

Does MB_CLIENT need a one-shot bit on the REQ input?

Yes, for library version 6.0 the request is level-controlled in older versions but the reliable pattern is a rising edge: a request starts on the transition of REQ and you hold the bit until the instruction reports the transaction done, then drop it before the next request. A bit that stays high forever can keep re-issuing the same transaction and, with two instances, keeps both sessions busy.

Can two MB_CLIENT instances share one connection ID?

No. The connection ID and the instance data block belong together in pairs and each pair must be unique per connection, per the MB_CLIENT documentation for S7-1200 and S7-1500. Reusing a connection ID on two instances makes the second one attempt to re-establish a connection that the first already owns, which surfaces as 16#80C5.

Why did the communication come back after two weeks with a fresh project?

Two things changed at once: the project state and elapsed time. The server side likely released its stale sessions after a keepalive or idle timeout, and the new project brought only one connection. Reproduce the recovery by disabling the second instance, waiting for the server's session timeout, and watching the connection come up with a packet capture instead of rebuilding the project.

Is port 502 the reason the second connection is refused?

Not by itself. A TCP listener accepts many connections on one listening port; each is distinguished by its source address and port. The limit is the server implementation: how many client sessions the FX5U Modbus service allows and how it releases closed sessions. Without access to the Mitsubishi configuration, treat the server as a single-session device.

Keep reading

  • How-to

    Set up a CLICK Plus as Modbus TCP client to an S7-1200

    Yes: make the S7-1200 the Modbus TCP server with MB_SERVER mapped to a data block of INTs, and make the CLICK Plus the client with Send and Receive instructions aimed at the CPU's IP address and port 502. Write the shared register map first; the S7 logic copies physical inputs into it and applies its output words to the real outputs.

    Industrial networks

  • Troubleshooting

    Why a Micro850 will not read tags over a DF1 I/O server

    A Micro850 serves variables through a Modbus map you build in Connected Components Workbench, not through DF1 or ABLOGIX I/O servers, because its memory has no data-table files for those drivers to read. Map each variable, poll the mapped range with an independent Modbus client on unit identifier 1, and set the tag address to the offset that actually answers.

    Industrial networks

  • Troubleshooting

    Speeding Up Modbus RTU Writes Behind Polled Reads

    The writes are slow because the Modbus client driver owns the serial port and services one enabled instruction at a time, so a write queues behind every enabled read. Put each transaction in its own stage, put the write stages first, and advance the chain on completion; a write then waits at most one in-flight transaction.

    Industrial networks