A common issue faced by Modbus driver is this: the communication takes place, but the tag displays an error message. According to the driver log, you can identify a default error message. How can I interpret this message? Which are the protocol exception codes for Modbus driver?
Firstly, there are some exception codes expected by Modbus protocol; these codes are returned by a device whenever a request is received but can’t be executed, for any reasons. When the driver receives these codes, it will register them in its communication log alongside the “MODBUS exception response” message.
The following table lists the exception codes as well as their meaning. Codes not listed below are specific to certain devices; therefore, you should look them up in their respective documentation.
The function code received in the query is not an allowable action for the slave. If a Poll Program Complete command was issued, then this code indicates that no program function preceded it.
|02||ILLEGAL DATA ADDRESS||
The data address received in the query is not an allowable address for the slave and therefore cannot be used.
|03||ILLEGAL DATA VALUE||
A value contained in the query data field is not an allowable value for the slave.
|04||SLAVE DEVICE FAILURE||
An unrecoverable error occurred while the slave was attempting to perform the request action.
The slave has accepted a request and is processing it, but a long duration of time is required. This response is returned to prevent a timeout error from occurring in the master. The master can then issue a Poll Program Complete message to determine if processing is completed.
|06||SLAVE DEVICE BUSY||
The slave is processing a long-duration program command. The master should retransmit the message later when the slave is free.
|08||MEMORY PARITY ERROR||
The slave attempted to read extended memory, but detected a parity error in the memory. The master can retry the request, but service may be required on the slave device.
|0A||GATEWAY PATH UNAVAILABLE||Used alongside gateways. Basically, this code means the gateway couldn’t allocate an internal path to process the request. Therefore, the gateway could probably be misconfigured or overloaded.|
|0B||GATEWAY TARGET DEVICE FAILED TO RESPOND||Used alongside gateways. Basically, this code means that no answer was received by the destination device. Therefore, the device could probably be absent from the network.|
The articles below all refer to common issues faced by the Modbus driver:
- Multiple slaves with RS-485 converter.
- Discontinuous address in the device.
- Incrementing non-standard addresses.
- Scrambled bytes and words.
- Registers addresses indexation.
- Interpreting addresses prefixes.