Modbus Gateway


What you will find in this section:

  1. Modbus gateway
  2. Related topics

 

Modbus gateway

 

EMpro versions with an RS-485 interface can optionally be operated in gateway mode.

By default upon delivery, the gateway mode is not active. In this case, the device acts as Modbus TCP server on the Ethernet interface and as Modbus/RTU server on the RS-485 interface.

When the gateway function is activated, the device behaves as Modbus gateway on the Ethernet interface and, in parallel, continues to operate as Modbus TCP server (can be reached via unit identifier == 255).

On the RS-485 interface, the device now acts as Modbus/RTU client. As client, the EMpro can now independently send queries in the network (note: there must be no other client in the system).


As Modbus gateway, the device converts an incoming Modbus TCP message (that does not have the unit identifier 255 in the MBAP header) into a Modbus RTU message and forwards it to the appropriate receiver in the Modbus RTU network. On the TCP side, the unit identifier is used for addressing the Modbus RTU receiver. In turn, the response is converted from Modbus/RTU format back to Modbus/TCP format and is sent to the querying client as Modbus/TCP response.

 

Broadcast messages in gateway mode

The Modbus specification does not describe the behavior of a gateway device when the unit identifier in the MBAP header has a value of 0. In the Modbus/RTU network, this value represents a broadcast message.

There are different interpretations of the behavior of a gateway in this case.

The following questions regarding the behavior of a gateway remain open:

  • Forwarding the broadcast in the RTU network.
    Since there is no broadcast in the case of Modbus/TCP, it is not defined whether or not the MBAP address 0 is forwarded in the RTU network by the Modbus gateway.
  • Response messages with the unit identifier 0.
    Neither is there a definition on whether the gateway itself generates an answer to messages with a unit identifier of 0.

By default upon delivery, devices of the EMpro product family behave as follows:

The EMpro does not forward messages with unit identifier 0 to the RTU network as broadcast. Furthermore, the EMpro itself responds to the query as Modbus TCP server.

Timing in gateway mode

As gateway, the EMpro acts as Modbus client on the Modbus/RTU side and forwards queries to the addressed servers.

As Modbus/RTU client, the device requires a time-out for queries. If this time-out has expired without a response from the Modbus/RTU server, the gateway replies to the Modbus/TCP client with an error message.

By default upon delivery, the duration for the time-out is 250 ms.

Unsuitable time-out settings both at the gateway and and at the querying Modbus/TCP client can cause unwanted problems.

Problems can occur if the time-out times at the Modbus/TCP client or EMpro in gateway mode are too short, or if the ratios between these two time-out times are unfavorable.

The time-out setting has to be individually configured based on the application.

Nevertheless, the following recommendations can be given; they should work in normal cases.

  • The default setting of the EMpro is adequate for most applications.
  • If there are servers with slow response times in the RTU network, the time-out setting of the gateway should be increased.
  • If very slow Baud rates are used on the RS-485, the time-out setting of the gateway should be increased.
  • The time-out duration of the querying Modbus/TCP client should always be longer than that of the gateway.

 

  1. Function
  2. Modbus/TCP

 


EMpro online documentation
Published/reviewed: 2025-07-15, en revision 003Version history