3 com port packets, 1 maximum packet size, 2 command packets – Sensoray 2600 User Manual

Page 25: 3 response packets

Advertising
background image

2600 Family Instruction Manual

20

Chapter 4 : Serial Communication Server

4.3 Com Port Packets

The Ethernet client communicates with the MM’s serial
communication ports via com port packets. There are two
types of com port packets: command and response.

Com port command packets are transmitted from the client to
the MM, which in turn performs the requested operation. The
MM constructs a com port response packet as appropriate for
the operation performed and then it transmits the response
packet to the client.

Every com port packet is encapsulated in a single UDP payload
as shown in Figure 26. A com port packet completely occupies
the payload portion of its encapsulating UDP datagram.

Figure 26: Com Port Packet Encapsulation

4.3.1 Maximum Packet Size

Because com port packets occupy the payload region of
Ethernet-based UDP datagrams, each com port packet is
limited to a theoretical maximum size of 1472 bytes. As a
practical matter, however, com port packets are limited to a
maximum of 1024 bytes, which is the maximum amount of
available transmit buffer space when sending data, or the
largest possible received character count associated with the
target com port.

4.3.2 Command Packets

Each com port command packet is directed to a specific com
port for execution. The com port to which a command packet
is directed is determined by the destination UDP port number
specified in the encapsulating UDP datagram. For example,
any UDP datagram addressed to UDP port 10001 will be
directed to COM1. See Section 1.2.2 for a discussion of UDP
port assignments on the MM.

Exactly one operation is invoked per com port command
packet. The operation that is to be performed is denoted by a
one-byte opcode at the beginning of the packet. The opcode is
followed by zero or more command-specific data bytes.

Figure 27: Com Port Command Packet Structure

The size and meaning of the values contained in the Data[]
field depends on the function that is to be performed, as
dictated by the Opcode byte. See Section 4.4 for descriptions
of supported commands.

The opcode byte may be modified so as to enable the MM’s
retry mechanism. See Section 3.1.1.2 for details.

4.3.3 Response Packets

Each com port response packet is sent to the client’s
originating IP address and UDP port number. As shown in
Figure 28, a com port response is composed of a status byte
followed by one or more command-specific data bytes.

Figure 28: Com Port Response Packet Structure

4.3.3.1 Status Byte

The first byte of every com port response packet contains a set
of active-high bit flags (see Figure 29) that indicate the state of
the associated com port. Unless stated otherwise, the returned
status byte indicates the state that is in effect immediately after
the command executed.

Figure 29: Com Port Status Byte

Status bit flags are defined as follows:

REJ indicates that the most recent com port command was

rejected. This flag will be set if execution of the command
would have caused an error or if the opcode is illegal.

UDP Datagram

Command Packet

Response Packet

UDP Header

UDP Payload

Com Port Command Packet

Com Port Response Packet

Field

Function

Opcode

Command opcode. This opcode indicates the function
to be performed. The opcode byte may be modified as
described in Section 3.1.1.2.

Data[]

Command-specific data. This field contains zero or
more bytes, depending on the function to be performed.

Field

Function

Status

Status flags associated with the associated com port.
See Section 4.3.3.1 for details.

Data[]

Command-specific response data. This field contains
zero or more bytes, depending on the function that was
performed.

Opcode

Data[]

Status

Data[]

7

REJ

6

0

5

4

0

3

FRM

2

1

0

OPN

0

PAR

OVR

Error Flags

Advertising