Serial Port and Serial Communications

Serial port of the DS has two modes of operation:

Data routing mode. Incoming serial data is routed to the Ethernet port and Ethernet data is routed to the serial port. It is in this mode that the DS performs its routing function. After the powerup the DS is running in the data routing mode.

Serial programming mode. In this mode the serial port is used for serial programming and all data received into the serial port is interpreted as programming commands.

Data connection with the network host can still be established and maintained while in the serial programming mode but the data received from the network host will be discarded and the data received into the serial port will be interpreted as commands. Therefore, data exchange with the network host and serial programming cannot be concurrent. DS can only perform one of the two at any given time. This is different from the network programming that can be performed concurrently with the data routing.

Operation of the serial port in the data routing mode is governed by several settings (see below), some of which (baudrate, parity, etc.) have corresponding parameters. These parameters are delivered to the DS via the networkParameter (P) command and are commonly known as on-the-fly commands (or, more officially, network-side parameters). On-the-fly commands provide a way for the network host to immediately change communications mode of the serial port without rebooting the DS. There are also network-side instructions (Set I/O Pin Status (Sx) and Get I/O Pin Status (Gx) ) that are used to set and sense the state of RTS, CTS, DTR, DSR, and also additional P0 and P1 lines* of the DS.

Serial port of the DS has the following capabilities:

Half-duplex or full-duplex operation as defined by the Serial Interface (SI) setting;
Baudrates of up to 115200 bps as defined by the current Baudrate (BR) [setting/ parameter];
7 or 8 bits/byte as defined by the current Bits Per Byte (BB) [setting/ parameter];
Several parity options as defined by the current Parity (PR) [setting/ parameter]**;
There are also several options related to the RTS, CTS, DTR, and DSR lines:
In full-duplex communications the RTS and CTS lines can be programmed to serve as flow control lines between the DS and attached serial device- this is defined by the current Flow Control (FC) [setting/ parameter];
In half-duplex serial communications the RTS line serves as a direction control line (see Serial Interface (SI) setting for details). This is why this line is called "RTS/DIR";
The CTS line optionally serves as an additional function of selecting between full- and half-duplex communications (see "auto" selection of the Serial Interface (SI) setting).
DTR line can be programmed to reflect current data connection status- see the DTR Mode (DT) setting;
DSR line can be programmed to control data connection establishment and termination- see the Connection Mode (CM) setting;
Once again, the status of RTS and DTR lines can be controlled (set) by another network host using the Set I/O Pin Status (Sx) instruction, while the status of CTS and DSR lines can be monitored (polled) using Get I/O Pin Status (Gx) instruction
Additionally, the DS can be programmed to notify another network host of the state changes of its RTS, CTS, DTR, DSR, P0, and P1 lines*. Which lines are monitored for changes is defined by the current Notification Bitmask (NB) [setting/parameter]. Notifications are delivered in the form of Notification (J) messages to the port defined by the Notification Destination (ND) setting.

* Whether or not these lines are physically implemented depends on the DS model.

** There is not way to set the number of stop bits directly but the second stop-bit can be emulated by setting current Parity (PR) to 3 (mark).

*** HI and LOW states are described with respect to the serial ports of DS100R, DS100B, DS203. For EM100, EM120, EM200, EM203(A) the signaling is exactly opposite.