IMD SolutionComputing LibraryShop main store

Explainer

Why master-only Modbus TCP PLCs force the Flexy into the server role

Edge computing and IIoT Published 6 min read By IMD Solution engineering team

Short answer

A Modbus TCP master-only port can initiate requests but never answer them, so nothing can poll those PLCs. Configure the Flexy as the Modbus TCP slave/server, enable its server on the Modbus IO server page, and let both X20 PLCs poll it as masters over port 502. The data still lands in Flexy tags; only the transaction direction changes.

On this page
  1. Why a master-only port cannot be polled
  2. The configuration that works
  3. What reverses in the data flow
  4. Two masters, one server
  5. Commissioning check
  6. The decision
  7. Questions asked

Your two B&R X20 PLCs cannot be polled over Modbus TCP, and no Flexy setting changes that: a Modbus TCP master is the side that initiates every transaction, and a port that can only be a master never answers a request. The working design reverses the direction. The Flexy runs as the Modbus TCP slave/server, both PLCs stay masters, and each PLC reads and writes its own area of the Flexy server's data. The data still lands in Flexy tags, so the acquisition goal is met; only the transaction direction changes. Here is why the roles decide this, the Flexy setting that enables the server, the PLC-side configuration, and the test that proves both masters are served.

Why a master-only port cannot be polled #

Modbus TCP is a client/server protocol: only the client initiates transactions, and the server only answers. The serial-line vocabulary calls the same two roles master and slave — the client role is implemented by the master, the server role by the slave — which is why the PLC documentation and the Flexy documentation use different words for the same two jobs. The Modbus Messaging on TCP/IP Implementation Guide keeps that model: every request travels client to server, and a server never speaks first.

That is the entire explanation. The Flexy's Modbus TCP IO server, in the configuration your original design assumed, is a master: it opens connections and sends read and write requests. A master-only port has no server endpoint — nothing on it listens for a Modbus request — so a request aimed at it has no listener to answer. With both PLC ports master-only, the Flexy-as-master design has zero reachable servers and cannot work, whatever addresses, timings or firmware you set. This is the transaction model, not a defect in either product. The only direction your hardware supports is PLC to Flexy, so that is the direction you use.

The configuration that works #

Device Modbus TCP role What it does
First X20 PLC master (client) Initiates reads and writes to the Flexy
Second X20 PLC master (client) Initiates reads and writes to the Flexy
Flexy slave (server) Answers both and exposes its tags as holding registers

On the Flexy, open Tags -> IO Servers -> IO Servers List -> Modbus and, at the top of the page under "MODBUS TCP Server", enable the "Ewon Server" checkbox. That is the documented switch that makes the Flexy a Modbus TCP server, and the same page is how the vendor publishes Flexy tags as holding registers. The server listens on port 502, the standard Modbus TCP port on these units; the vendor also documents the changes needed to use another port such as 503, but nothing in this design calls for moving.

On each PLC, keep the Ethernet port as it is: under "Modbus parameters" in the port configuration, "Activate Modbus communication" stays "on", and the port keeps the master role your hardware offers. Point both masters at the Flexy's IP address on that same port, and give each one the register range it will use. The PLC-side settings that must match the server — target address, port, timeouts, register map — are collected in what you must configure on the PLC side for Modbus TCP.

One security note: Modbus TCP carries no authentication and no encryption, so keep these connections inside the controlled OT segment and do not forward the server port through the Flexy's WAN side.

What reverses in the data flow #

In the original design the Flexy scanned the PLCs on an interval you configured. In the working design each PLC decides when data moves: its own poll configuration sets the rate and the Flexy answers. Values a PLC writes into its register range appear in the mapped Flexy tags, and whatever the Flexy publishes, both PLCs can read. You give up the Flexy as timing master on this link and keep everything you actually wanted, which is the data in Flexy tags.

The vendor's knowledge base confirms that the tags publish as holding registers but does not fix the addresses; the map is yours to define. Give each PLC a separate, non-overlapping range so a write from one master can never land in the other's data, and settle the map before either PLC is configured.

The wire load of the reversed design is worth calculating once. Worked example: each PLC reads 50 holding registers from the Flexy every 250 ms.

  • Data per read: 50 registers × 2 bytes = 100 bytes.
  • Response frame: 7-byte MBAP header + 1-byte function code + 1-byte byte count + 100 bytes of data = 109 bytes.
  • Request frame: 7-byte MBAP header + 1-byte function code + 2-byte start address + 2-byte quantity = 12 bytes.
  • One transaction: 109 + 12 = 121 bytes.
  • Rate: 1000 ms ÷ 250 ms = 4 transactions/s per PLC, so 8 transactions/s for the pair.
  • Wire load: 8 × 121 bytes/s = 968 bytes/s ≈ 7.7 kbit/s (968 × 8 = 7744 bit/s).

Any plant network carries that without noticing. One read returns at most 125 registers, so 50 registers fit a single request; a map beyond that limit splits into several requests per poll. The figure that matters is not bytes but transactions per second served with both masters running, and the commissioning check below proves exactly that.

Two masters, one server #

Nothing in Modbus TCP limits a server to one client. Each master opens its own TCP connection to port 502 and the server answers requests as they arrive, session by session. When one Modbus TCP server can serve two clients walks through that session behavior in detail, and none of it changes when the server is a Flexy. What you own on your side is the map — separate ranges so the two sessions stay separate in the data as well as on the wire — and both masters pointed at the same server address. Two clients on one server is ordinary Modbus TCP service, not a special mode.

Commissioning check #

Run these four steps in order; each isolates a different failure.

  1. With the server enabled, confirm each X20 shows an active connection: master role on, target address and port correct.
  2. From the first PLC alone, write a known value (for example 1234) into a register in its own range and confirm the mapped Flexy tag reads 1234.
  3. Repeat from the second PLC alone and confirm the first PLC's value is untouched — that proves the ranges are genuinely separate.
  4. Run both PLCs together at the planned rate and confirm both data sets keep updating. This is the two-client proof; if one side stalls while the other continues, compare the two connections — target, port, range — before touching the Flexy.

The decision #

  • Your ports are master-only: run the Flexy as the Modbus TCP slave/server with the "Ewon Server" checkbox enabled, keep both PLCs as masters, give each its own register range, and prove the pair with the four steps above. That is the design, and on this hardware there is no other direction.
  • If a future PLC port can be a server, Flexy-as-master polling becomes available for that device; nothing else in this setup changes.
  • Either way: one server, two clients, separate ranges, both proven together.

Questions asked

Can the Flexy go back to polling these PLCs later?

Only if the PLC side can act as a Modbus TCP server. With the ports fixed as masters, a Flexy master has nothing to talk to, so for these two devices the server role on the Flexy is permanent. Serving them does not stop the Flexy polling other equipment that does answer Modbus requests; that is a separate entry in the same IO server list.

Do the two PLCs need different unit IDs to share the Flexy?

No. The unit ID identifies the server being addressed, and both masters address the same one. Separation comes from the map, not the addressing: each master works in its own holding-register range, so their writes cannot collide even though they use identical addresses and ports.

Which Modbus function codes carry the data?

Reads use function 3, read holding registers, capped at 125 registers per request. Multi-register writes use function 16, write multiple registers, capped at 123 registers; a single-register write can use function 6. Because the Flexy publishes its tags as holding registers, all three apply to this design.

What changes if a third master must be served later?

Nothing in the roles: a third master opens its own connection and gets its own register range, exactly like the first two. Its wire load follows the arithmetic of the worked example and stays under a kilobyte per second at that rate, and the acceptance test is unchanged: every client keeps updating while all poll together.

Keep reading

  • Explainer

    Edge gateway Modbus TCP polling over the WAN port

    When a data gateway supports MQTT as a client only, drop the broker hop: configure the Modbus TCP poll to target the device's IP address in the same subnet as the gateway's WAN interface. The gateway opens the TCP connection itself, so polled values keep updating with the internet link down. Verify by pulling the uplink and watching one known register.

    Edge computing and IIoT

  • How-to

    MQTT to Modbus TCP with Node-RED on an edge gateway

    Yes: Node-RED with the node-red-contrib-modbus package can serve MQTT data to a SCADA client as Modbus TCP. Read the RTU device in Node-RED first, give the Modbus server node a port nothing else owns, and scale each MQTT payload to one integer per holding register before the first end-to-end test.

    Edge computing and IIoT

  • How-to

    Sending PLC data to an IoT hub without custom software

    You do not need custom software to move PLC data to an IoT hub: a configurable edge package with an S7, Modbus TCP or EtherNet/IP driver, a channel mapping and an MQTT publisher replaces hand-written acquisition code. Verify two things before you commit: the driver covers the protocol your controller actually speaks, and the publisher covers the destination's authentication and message format. Software still does the work — you configure it instead of writing it.

    Edge computing and IIoT

Why eWON Flexy BASIC cannot write to MySQL directly