Pipe Protocol Shared Memory Protocol navigation bar

Table of Contents >Quanser Rapid Control Prototyping Toolkit >Communication Protocols >

Serial Protocol

The serial communications protocol supports communications over a standard serial port.

Syntax

serial://hostname:port?option=value,... % Access serial port "port" using specified options
    

Description

The serial communications protocol supports communications over a standard serial port, such as COM1 in Windows. . It is identified by using serial as the protocol name in a URI.

The hostname in the URI is ignored. However, to have a properly formed URI the hostname must be specified. It is best to specify the "remote" host or device with which communications is being performed as a reminder of what is connected to the serial port.

The port in the URI determines the serial port used for communications. In Windows, the port number is appended to the string "COM" to form the name of the port. For example, the URI serial://gps-sensor:2 refers to a GPS sensor connected to COM2.

Hint When communicating between two different targets via the serial port, be aware that timers on the two targets may differ ever so slightly due to crystal oscillator or operating system discrepancies. To ensure reliable communications, it may be necessary to ensure the receiving system is operating at a slightly higher sampling period than the transmitter.

Limitations

Performance

Warning Note that the number of bytes per second that may be transferred over a serial connection is generally less than 1/10 of the baud rate. For example, transfer rates of more than 5.7 kB/sec should not be expected from a 57600 baud connection. Furthermore, the data type being transmitted must also be taken into account. Since a double value is 8 bytes, no more than 720 doubles/sec may be transferred using a 57600 baud connection. For a 1KHz sampling time, that's less than one double value per sampling instant!

Multiple client connections

Warning The serial protocol will only accept a single client connection at a time on a given port. It does not support time-division multiplexing of multiple client connections over a single serial port because doing so would require adding a header to the information packets sent over the port. RCP communication protocols never add extra information to the data sent over the communication channel in order to allow RCP to communicate with user applications, sensors and other devices which would not support RCP-specific data packets.

Options

baud

Set this option to the baud rate desired. If the baud rate is not supported by the serial port then an error will be issued at runtime when an attempt is made to use the serial port. Standard baud rates are shown in the table below. Baud rates over 115200 are typically not supported by serial drivers. The default baud rate is 115200.
75 150 1200 4800 14400 57600 230400
110 300 1800 7200 19200 115200 960800
134 600 2400 9600 38400 128000 921600

word

Set this option to the word length desired. Word lengths of 5, 6, 7 or 8 bits are supported. The default word length is 8 bits.

stop

Set this option to the number of stop bits desired. Values of 1, 1.5 or 2 bits are supported. Note that 1.5 stop bits is only supported with a word length of 5 bits. A word length of 5 bits does not support 2 stop bits. One stop bit may be used with any word length and two stop bits may be used with word lengths of 6-8 bits. The default number of stop bits is 1.

parity

Set this option to the parity setting desired. Parity values of none, even, odd, mark and space are supported. The first letter may also be used as an abbreviation. The default parity value is none.

flow

Set this option to the flow control desired. Valid values are none, hardware and software. The abbreviations hw and sw may be used instead. The default flow control is none.

memsize

Set this option to set the size of the serial send and receive buffers. The default buffer size is 1200 bytes. Setting this option is equivalent to setting both the sndsize and rcvsize options to this value.

sndsize

Set this option to set the size of the serial send buffer. The default buffer size is 1200 bytes.

rcvsize

Set this option to set the size of the serial receive buffer. The default buffer size is 1200 bytes.

device

Set this option to the prefix to use for the device name for the serial device.

Driver

The driver supporting serial communications is called qrt_serial.

Targets

Target

Supported

Comments

RCP Windows (64-bit) Target

Yes

Fully supported.

See Also

 

navigation bar