Modbus Server troubleshooting
For Modbus Server troubleshooting, the following sections list common tasks and problems.

The features and functions available in a node are controlled by the licenses that are installed in the node.
To verify that the Modbus Server license is installed:
- From the Workbench left pane, expand the node whose license you want to check, and then select the Administration icon.
- From the Administration window, select the Licenses tab.
- Select the appropriate license. Details of the license appear on the tab.
- View the Features column to identify the device driver.
If you do not see the correct license, or if the license is expired, you must request a license from your license key provider.
For information on how to install a license, refer to System Administration > Licenses.

The number of active devices or connections exceed the total active device license count.The server or listener device will reject the connection attempt.
A system generated Alert will be displayed when the number of active device licenses in use exceeds a threshold percentage of the total active device licenses for the node. The Alert is cleared when the usage drops below the threshold percentage. For example, the system is currently using 90% of the available 200 device licenses.
An Exceptions Log message is inserted for the first connection rejection. For example, Device connection rejected due to insufficient device licenses.
For more information, see Licenses.
The device information on the Devices panel for a started server or listener device displays counts on its Attributes sub-tab:
- License In-Use
- License Rejected.

The Modbus Server is not part of this node's installation. The Modbus Server is installed as a package separate from the base product installation.
You may be working with different levels of nodes, each with different levels of support for devices. Ensure that this node is the one with support for the Modbus Server.
For information on how to add the Modbus Server package, refer to System Administration > Packages.

Typically Modbus devices communicate over Ethernet connections using port 502. A Modbus Server device uses port 502 as the default. If another service is using this port the Modbus Server device will not be able to start. In this situation you will either have to free this port or configure the Modbus Server device to use a different port. If a different port is selected, ensure that the Modbus clients connecting to Modbus Server device are aware of the new port designation.

The Modbus Server has been implemented according to the Modbus Application Protocol Specification v1.1b. The Modbus Server supports the following function codes in the format defined in the protocol specification.
Code | Description | Format |
---|---|---|
01 | Read Coil | Function Code - 1 Byte Starting Address - 2 Bytes Quantity of Coils to Read - 2 Bytes |
02 | Read Discrete Input | Function Code - 1 Byte Starting Address - 2 Bytes Quantity of Discrete Inputs to Read - 2 Bytes |
03 | Read Holding Register | Function Code - 1 Byte Starting Address - 2 Bytes Quantity of Holding Registers to Read - 2 Bytes |
04 | Read Input Register | Function Code - 1 Byte Starting Address - 2 Bytes Quantity of Input Registers to Read - 2 Bytes |
05 | Write Single Coil | Function Code - 1 Byte Coil Address to write to - 2 Bytes Value to write - 2 Bytes |
06 | Write Single Holding Register | Function Code - 1 Byte Holding Register Address to write to - 2 Bytes Value to write - 2 Bytes |
08 | Diagnostics (Serial Line Only) | Function Code - 1 Byte Sub-Function Code - 2 Bytes Data - N x 2 Bytes Note: The Modbus Server does not perform any diagnostic check. It will simply echo back the frame that it receives. |
0F | Write Multiple Coils | Function Code - 1 Byte Starting Address - 2 Bytes Number of Coils to be written - 2 Bytes Byte size of the values to be written - 1 byte Values to write - N x 1 Byte, where N = Number of Coils / 8 + 1 if the remainder is > 0 |
10 | Write Multiple Holding Registers | Function code - 1 Byte Starting Address - 2 Bytes Number of Holding Registers to write - 2 Bytes Byte size of the values to be written - 1 byte Values to be written - Number of Holding Registers * 2 Bytes |

The most common reason for a failure when connecting through the serial port to a node is the Baud Rate parameter. The default value for the Baud Rate parameter for a serial connection to a Modbus Server device, is 19200. Ensure that rate is compatible with the Modbus client. Though this is the most common problem, ensure that the Stop Bits, the Data Bits, and the Parity parameters defined for the Modbus Server device are compatible with the Modbus client.
Some nodes require the use of a Null Modem cable or a Null Modem gender changer connector when connecting to the node's serial port. Please see the node's hardware guide for any requirements of the serial port and how it can be used when communicating with a Modbus client application.

The Modbus Server allows you to define a maximum number of clients that can be connected at one time. The Modbus Server keeps a running count of how many clients are actively connected while it is running. Clients that attempt to connect to the Modbus Server once the maximum connection count has been reached will be rejected by the Modbus Server. The active connection value is decremented when a client closes its socket connection to the server, which will allow a new client to connect, in the scenario where the maximum connection count has been reached.
The Modbus Server, running on the Linux operating system, may not be notified of socket error conditions that originate from the client. If the server is not notified of these error conditions, then the Modbus Server will not decrement the active connection count when the client error occurs. An example of this would be a client whose Ethernet cable becomes disconnected after it had previously connected to the Linux Modbus Server. Linux does not raise this disconnected socket error condition to the Modbus Server, so the Modbus Server has no way of knowing this client is no longer connected. If the Modbus Server has reached its maximum number of connections limit, no further connections can be accepted until the Linux operating system notifies the Modbus Server of the invalid client connection. Once the Modbus Server has been notified, it will close the connection and decrement the active connections counter, which will make available an additional connection.