Serial-to-Ethernet Data Routing

The challenge of serial-to-Ethernet data routing is to choose how to group the serial data into the Ethernet packets of reasonable size. Carrying too little data in each packet increases network load while sending packets with too much data slows down the delivery of this data to the network host (because all this data needs to be accumulated in the buffer first). A dedicated group of packet encapsulation settings controls how and when the serial data is turned into the Ethernet packets and sent out to the network host.

When in the data routing mode the serial port of the DS treats all incoming serial data as a sequence of serial data blocks* . In many cases serial traffic to and from the attached serial device is structured in some way (i.e. using some sort of data packets). Since it is only logical to apply the same division to the outbound network packets the DS can be programmed to recognize the beginning and the end of serial data blocks. This does not mean that the DS can only work with structured serial data- absolutely random data stream can simply be thought of as one continuous serial data block.

Serial data blocks begin when the start condition is detected and end when the stop condition is detected. After the start condition is detected the DS begins recording all incoming serial data into the serial-to-Ethernet routing buffer **. Thus, the start condition is said to open a data block. When the stop condition is detected the DS stops recording incoming serial data into the buffer (closes the serial data block) and commits all the data in the serial-to-Ethernet routing buffer. Committed data is the data that the DS will attempt to route to the network host at the earliest possible opportunity. Before the data is committed the DS does not attempt to route it. Therefore, the number of committed bytes in the serial-to-Ethernet buffer may be smaller than the total number of bytes.

The DS ignores all data between the serial data blocks.

Besides the start and stop conditions there is also a break condition. When the break condition is detected the DS commits the data in the buffer but does not close the serial data block. Break conditions provide a way to subdivide large serial data blocks.

Follows is the description of available start, stop, and break conditions:

Start conditions. It is possible to make the DS either open a new serial data block after it receives any character (past the end of the previous data block) or a specific preset character- this is defined by the Start On Any Character (SA) setting . When this setting is 0 (disabled) then two other settings- Use Start Character (F1) and Start Character Code (S1) are used to enable and select specific start character. New serial data block is opened only if this start character is received. All characters between the end of the previous serial data block and the start character are ignored. Start characters received after the serial data block has been opened are treated as normal data characters and do not "reopen" the serial data block.

Stop condition is defined by the stop character which is enabled and selected via two separate settings- Use Stop Character (U1) and Stop Character Code (E1) . When the stop character is disabled no stop conditions are generated at all i.e. once opened, the serial data block never ends. Additionally, the Number Of Post Characters (P1) setting defines the number of characters past the stop character that will be counted as belonging to the same data block.

Break conditions are generated depending on two settings: Maximum Intercharacter Delay (MD) and Maximum Data Length (ML) . The first one defines the maximum time, in milliseconds, the DS will wait for the arrival of the next serial character. If this time is exceeded the break condition is generated. The second setting defines the number of bytes in the serial-to-Ethernet buffer, which, when exceeded, will generate a break condition.

Note, that all settings described above do not directly define the length of individual Ethernet packets generated by the DS, but only define when the data in the serial-to-Ethernet buffer is committed. Once the data is committed the DS will attempt to deliver this data to the network host as soon as possible but not necessarily in one "chunk".

Factory defaults for the packet generation settings provide a simple and usually acceptable schema: start on any character is enabled, stop-character is disabled, maximum intercharacter delay is set to 1 (10ms), and maximum data length is 255 bytes for UDP transport protocol and 127 bytes for TCP (see Maximum Data Length (ML) setting for explanation). This setup is universal and can handle random data of any size. All data is recorded into the serial-to-Ethernet buffer and committed either when the maximum size is reached or when there is a gap in the serial data arrival.

* The term "serial data blocks" was coined to avoid using the word "packets" that might cause a confusion with the network packets.

** The serial port must be opened for this to happen.