Buffl

Lecture Notes Application Protocols

CF
by Carmen F.

Modbus TCP/IP

describes how the Modbus protocol must be adapted to run over TCP

Modbus TCP Management layer implements the use of the Modbus Application Protocol over TCP/IP. It manages the connection establishment and ending, and manages the data fow on established TCP connections. The listening TCP port 502 is reserved for Modbus communications. In this layer integrated is the Access Control Module. The goal of this module is to check every new connection and using a list of authorized remote IP addresses the module can authorize or forbid a remote Client TCP connection. Use of the Access Control Module is optional.

Modbus TCP/IP is not limited to 247 devices, as it was the case with Modbus Serial. The addressing is done via the IP addresses of the Modbus TCP/IP devices.


The Modbus worker address feld usually used on Modbus Serial Line is replaced by a single byte Unit Identifer within the MBAP Header. The Unit Identifer is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units.

All Modbus requests and responses are designed in such a way that the recipient can verify that a message is finished. For function codes where the Modbus PDU has a fxed length the function code alone is suffcient. For function codes carrying a variable amount of data in the request or response, the data feld includes a byte count.

When Modbus is carried over TCP, additional length information is carried in the MBAP header to allow the recipient to recognize message boundaries even if the message has been split into multiple packets for transmission.

CoAP Mesage format


Version (V): 2-bit unsigned integer. Indicates the CoAP version number. Implementations of this specification MUST set this field to 1 (01 binary). Other values are reserved for future versions.

ˆType (T): 2-bit unsigned integer. Indicates if this message is of type Confirmable (0), Non-confirmable (1), Acknowledgement (2), or Reset (3).

ˆToken Length (TKL): 4-bit unsigned integer. Indicates the length of the variable-length Token field (0-8 bytes).

ˆCode: 8-bit unsigned integer, split into a 3-bit class (most significant bits) and a 5-bit detail (least significant bits). The class can indicate a request (0), a success response (2), a client error response (4), or a server error response (5). (All other class values are reserved.) As a special case, Code 0.00 indicates an Empty message. In case of a request, the Code field indicates the Request Method; in case of a response, a Response Code.

Message ID: 16-bit unsigned integer. Used to detect message duplication and to match messages of type Acknowledgment/Reset to messages of type Confirmable/Non-confirmable.

the Token value, which may be 0 to 8 bytes, as given by the Token Length field. The Token value is used to correlate requests and responses

zero or more Options. An Option can be followed by the end of the message, by another Option, or by the Payload Marker and the payload.

optional payload. If present and of non-zero length, it is prefixed by a fixed, one-byte Payload Marker (0xFF), which indicates the end of options and the start of the payload. The payload data extends from after the marker to the end of the UDP datagram, i.e., the Payload Length is calculated from the datagram size.

it is recommended that the message fit within a single IP packet and UDP payload to avoid fragmentation

coap-URI = “coap:” “//” host [ “:” port ] path-abempty [ “?” query ]

If the host component is provided as an IP-literal or IPv4address, then the CoAP server can be reached at that IP address. If host is a registered name, then that name is considered an indirect identifier and the endpoint might use a name resolution service, such as DNS, to find the address of that host. The port subcomponent indicates the UDP port at which the CoAP server is located. If it is empty or not given, then the default port 5683 is assumed.

While running over UDP, CoAP o ers a reliable transmission of messages when a CoAP header is marked as confirmable. In addition, CoAP supports basic congestion control with a default time-out, simple stop and wait retransmission with exponential back-off mechanism, and detection of duplicate messages through a message ID. If a request or response is tagged as confirmable, the recipient must explicitly either acknowledge or reject the message, using the same message ID. If a recipient can't process a non-confirmable message, a reset message is sent.

Author

Carmen F.

Information

Last changed