MODBUS Exceptions

The MODBUS standard defines a fixed set of exception codes, with implicit interpretations. These should be used in conjunction with the cyg_modbus_exception() function by backend handlers to notify the requesting client of an error.

MODBUS_EXCEPTION_ILLEGAL_FUNCTION

The function code received in the request is not an allowable action for the server. This may be because the function code is only applicable to newer devices, and was not implemented in the unit selected. It could also indicate that the server is in the wrong state to process a request of this type, for example because it is unconfigured and is being asked to return register values.

MODBUS_EXCEPTION_ILLEGAL_ADDRESS

The data address supplied in the request is not an allowable starting address for the server when taken into account with the number of items to be accessed. For example, for a device with 100 registers (accessed as addresses 0 thru 99) then the PDU supplied address 96 is valid when a request for 4 or fewer items is made, but invalid if 5 or more items are requested.

MODBUS_EXCEPTION_ILLEGAL_VALUE

A value suppled in the request is not valid for the server. This normally indicates a fault in the structure of a request PDU (e.g. unexpected length). It should be noted that it does NOT indicate that a supplied data item is outside of the set acceptable for a specific register. The MODBUS protocol does not interpret or apply any significance of any particular data values for any particular registers.

MODBUS_EXCEPTION_DEVICE_FAIL

Indicates an unrecoverable error occurred whilst the server was performing the requestion MODBUS function.

MODBUS_EXCEPTION_ACKNOWLEDGE

This is a specialized response used with specific programming commands. This is where the server has accepted a request, and is processing it, but where the action will take a long time to complete. This response is returned to the client to prevent a client timeout error waiting for a standard response. It is expected that the client will periodically issue the specific “Poll Program Complete” request to check if the processing has completed.

Note: The eCosPro-MODBUS server does not explcitly support this functionality, since it would be a feature of the user-application supplied backend driver.

MODBUS_EXCEPTION_DEVICE_BUSY

This is a specialized response used with specific programming commands. This is used to indicate to the client that the server is busy processing a long-duration command. The client should re-attempt the request in the future.

MODBUS_EXCEPTION_MEMORY_PARITY_ERROR

This exception is specific to the MODBUS_FUNC_READ_FILE_RECORD (20) and MODBUS_FUNC_WRITE_FILE_RECORD (21) functions, when using with reference type 6. It is used to indicate that the extended file area failed to pass a consistency check. i.e. the server attempted to read the record file, but detected a parity error in the memory. The client may retry the request, but maintenance of the server device may be required.

MODBUS_EXCEPTION_GW_PATH_UNAVAILABLE

This is a specialized exception returned in conjunction with gateway support. It indicates that the gateway was unable to allocate an internal communication path to the requested UID. This exception usually indicates the gateway device is misconfigured or overloaded.

MODBUS_EXCEPTION_GW_TARGET_FAILED

This is a specialized exception returned in conjuction with gateway support. It indicates that no response was obtained from the target device. This usually indicates that the target device is not present on the MODBUS network.

2017-02-09
Documentation license for this page: eCosPro License