Explainer
Why Modbus RTU over Ethernet is not Modbus TCP for an HMI
Short answer
An Ethernet port carries bytes, not a protocol. A PLC that tunnels Modbus RTU frames over Ethernet answers only frames carrying a slave address and a CRC, while an HMI Modbus TCP driver sends MBAP frames with no CRC, so the two never parse each other. Match the driver to the PLC's documented packet format, verify the driver's transport support, and put a translating gateway between them when the formats differ.
On this page
- Why does a Modbus TCP driver fail against a PLC with an Ethernet port?
- What is the difference between a Modbus TCP frame and a Modbus RTU frame?
- Example: how many bytes does each framing use for a one-register read?
- How do you find out which framing your controller actually speaks?
- What does the HMI driver need for RTU frames over Ethernet?
- When do you need a gateway, and which kind?
- What is the decision for each case?
- Questions asked
An Ethernet port on a PLC does not make it a Modbus TCP server. Modbus TCP and Modbus RTU carried over Ethernet put different bytes on the wire: the first frames every message with an MBAP header and no CRC, the second sends a plain RTU frame with a slave address and a CRC inside a TCP connection. An HMI driver built for one cannot parse the other, no matter how good the cable or how correct the register addresses. This page explains the two framings, works the byte counts for a one-register read, and ends with the decision for each case: match the driver to the controller's documented packet format, or put a translating gateway between them.
Why does a Modbus TCP driver fail against a PLC with an Ethernet port? #
Because TCP delivers bytes and the application protocol decides what those bytes mean: the HMI's Modbus TCP driver writes a frame with a 7-byte MBAP header and no CRC, while an RTU-over-Ethernet PLC waits for a serial RTU frame that carries a slave address and a CRC.
The socket opens, segments flow, and the exchange still dies, because each side discards a frame it cannot parse. The two protocols share function codes and register semantics, so the register map can be identical while the envelopes are not. That is why re-checking tag addresses, rebuilding screens or swapping the patch cable changes nothing: the failure happens before addressing is ever evaluated.
What is the difference between a Modbus TCP frame and a Modbus RTU frame? #
A Modbus TCP frame replaces the RTU slave address and the CRC with a 7-byte MBAP header, and it relies on TCP, not on a silent interval, to mark where each message starts and ends.
The MBAP header carries a transaction identifier that pairs each response with its request, a protocol identifier, a length field, and the unit identifier that replaces the serial slave address. A Modbus RTU frame is a slave address, the protocol data unit, and a CRC, and on a serial link the receiver uses silent intervals to find the frame boundaries; TCP's own sequencing takes over the integrity job on the network side. The length field is the part that tells a TCP receiver how many bytes follow the header, and the page on Modbus TCP framing and the MBAP length field walks through that field in detail.
Example: how many bytes does each framing use for a one-register read? #
For a read of one holding register, the Modbus TCP request frame is 12 bytes and the equivalent RTU frame is 8 bytes, and that 4-byte difference in envelope structure is why neither driver can parse the other's traffic.
Both protocols carry the same application data for this request: a Read Holding Registers function code, a 2-byte starting address, and a 2-byte register count, which is 5 bytes of shared PDU. Only the envelopes differ:
- Modbus RTU request: 1 byte of slave address + 5 bytes of PDU + 2 bytes of CRC = 8 bytes.
- Modbus TCP request: 2 bytes of transaction identifier + 2 bytes of protocol identifier + 2 bytes of length + 1 byte of unit identifier + 5 bytes of PDU = 12 bytes, with no CRC.
The responses move the same way. The RTU response is 1 byte of address + 1 byte of function code + 1 byte of byte count + 2 bytes of register data + 2 bytes of CRC = 7 bytes, while the Modbus TCP response wraps the same application bytes in the header for 11 bytes total.
The consequence is structural, not cosmetic. An MBAP-expecting driver reads the early bytes of an 8-byte RTU frame as a length that points past the end of the message and gives up; a CRC-expecting driver treats header bytes as address and data and rejects the frame at the CRC check. Same register, same function code, incompatible envelopes.
How do you find out which framing your controller actually speaks? #
Read the communications chapter for your exact controller model and port: the manual names the application protocol, and a device described only as "Modbus over Ethernet" is usually tunneling RTU frames through a raw TCP socket rather than implementing Modbus TCP.
Three signs separate the two. The wording names the framing: mentions of MBAP, a transaction identifier or a unit identifier point to Modbus TCP, while wording about serial frames, a slave address or encapsulation points to the tunnel. The TCP port hints: 502 is the well-known port for Modbus TCP, and a manufacturer-specific raw port usually means the tunnel. A short packet capture settles it, because a Modbus TCP request begins with a protocol identifier of zero followed by a length field, and an RTU frame begins with the slave address and ends with a CRC.
Test with read requests first, and put any write test on an isolated bench with tags you have verified, because a mis-framed write is exactly the case neither device can validate before acting on it.
What does the HMI driver need for RTU frames over Ethernet? #
The driver must document RTU framing carried inside a TCP connection: a serial RTU driver that opens a local COM port and a Modbus TCP driver that builds MBAP frames both fail against such a controller, each for a different reason.
The capability is release-specific, so check the driver list of the software actually installed on the panel or workstation, not a plan or a memory of what the documentation once promised. A driver entry that names RTU and asks for a COM port, baud rate and slave address serves the serial link; one that names RTU and asks for an IP address and a TCP port is the tunnel-capable kind. If the installed release has only a Modbus TCP driver, the honest options are a driver update through the software's official distribution channel or a translating gateway. Do not schedule commissioning around an announced future driver, and do not treat the shared word RTU as proof that the serial driver will stretch across a network tunnel.
When do you need a gateway, and which kind? #
You need a gateway when the two sides demand different framings and no installed driver covers the tunnel: a translating gateway accepts Modbus TCP on the Ethernet side, strips the MBAP header, and emits a serial RTU frame with slave address and CRC on the device side.
Check the gateway's documented operating mode before buying, because the two kinds behave differently on the serial side. A transparent gateway forwards frames as they arrive and routes them by the Unit ID inside the frame; a gateway with a configured poll list rebuilds frames and runs its own serial transactions on a schedule. Either way the serial-side settings — baud rate, parity, stop bits — must match the downstream devices, and when the HMI itself will speak serial RTU on that side, selecting an HMI that talks Modbus RTU to remote I/O covers what that driver must document.
What is the decision for each case? #
Match the driver to the documented packet format and add translation hardware only when the formats differ: native Modbus TCP takes a Modbus TCP driver, RTU over Ethernet takes a tunnel-capable driver or a translating gateway, and serial-only RTU takes the HMI's serial port or the same gateway.
- The controller documents Modbus TCP — MBAP, a unit identifier, TCP port 502: use the Modbus TCP driver over the Ethernet port, and for the panel side of that match, selecting a Modbus TCP HMI panel for an existing controller walks the rest of the choice.
- The controller documents RTU frames over Ethernet — encapsulation, a slave address where a unit identifier should be: verify the installed driver's tunnel support, and if it is missing, put a translating gateway between the HMI and the controller rather than hoping the serial driver will stretch.
- The controller has serial RTU only: connect through the HMI's serial port, or through the same gateway when the HMI must stay on Ethernet.
In every case the controller's documentation, the installed driver list and a one-frame packet capture decide it in minutes, long before a cable or a register map is worth blaming.
Questions asked
Does Modbus RTU over Ethernet use TCP port 502?
Port 502 is the registered port for Modbus TCP, so a device listening there is probably a true Modbus TCP server. RTU-over-Ethernet tunnels usually listen on a raw TCP port the manufacturer chooses. The port is a strong hint but never proof: confirm the packet format in the controller's own documentation before configuring the driver.
Can one translating gateway serve several serial slaves?
Yes, that is normal service for a Modbus TCP to serial RTU gateway: the Ethernet side answers the HMI while the serial side fans out to the downstream devices, either routing frames by Unit ID in transparent mode or running a configured poll list. Check each downstream device's communication watchdog and output behavior on link loss before relying on it in production.
Why does the HMI report a timeout instead of a Modbus exception code?
A Modbus exception is generated after the server has parsed a valid frame and rejected the request inside the protocol. A framing mismatch dies earlier than that: the server never recognizes the frame, so the driver waits and reports a connection or response timeout. A packet capture of one request and its reply distinguishes the two cases quickly.
Does a framing mismatch mean the HMI panel has to be replaced?
No. The panel stays if any of the three fixes fits: a driver in the installed release that supports RTU framing over TCP, a translating gateway between the panel and the controller, or a serial port connection where the controller has one. Replace the panel only when its driver set cannot be extended and no gateway fits the architecture.