RS232 is a serial protocol which allows binary data to be exchanged between two end points over a cable. RS232 is generally provided by a UART (Universal Asynchronous Receiver Transmitter) within the microcontroller.
A large number of signals are defined in RS232 as shown below. At a minimum the RXD, TXD and GND lines are required - this is often referred to as '3-wire'. Adding flow control (RTS, CTS) increases this to 5-wire. Signals beyond these 5 are generally required only for modems, and provided by a 'full function' UART.
Typically a 'DB9' connector is used to connect a serial device. By convention a female DB9 is the DTE (Data Terminal Equipment, i.e. the master) and a male DB9 is the DCE (Data Circuit-terminating Equipment, i.e. the slave). In the case where both devices a DTEs, a 'null modem' cable is used, which switches transmit/receive and the flow control lines to enable communication to occur.
Within an RS232 frame, there is a start bit, a number of data bits, and optional parity bit and a stop bit. While it is possible for a receive and transmitter to get out of sync when the receiver misses part of a transmission, the start and stop bits help to ensure that this is rare.
RS232 is generally transmitted at 12V levels (-12V and +12V) but to save power and components it is often reduced to 0V and 3.3V within an embedded system. This avoids the need for level shifters if both the sender and receiver do not require it.
RS232 operates at a number of bit rates, typically 9600 or 115200, but higher and lower rates are supported. Bluetooth UARTs typically run at 961200 baud, for example.
Many signals are defined in the full function UART, as shown below:
|Data Terminal Ready
|Data Set Ready
|Request To Send
|Clear To Send
For more information on the RS232 standard and its history, see Wikipedia
End User Applications
RS232 is commonly used on modems, although many have moved to USB now, and in any case analogue modems are seldom used now that broadband Internet is more popular. Some laptop still provide an RS232 port, for example.
Bluewater has used RS232 in most projects as a console output.
In Roughy, a total of 10 RS232 ports were provided using the Snapper FPGA although these did not use a standard DB9 connector to reduce board space.
It is very common for an embedded system to have a single RS232 port designated as the 'console' where it is possible to see the unit boot up and display warning messages. It is good practice to keep this clear of other functions where possible, despite the increased cost this might incur. To reduce this cost, Bluewater has create Squid (see Squid) which removes the need for the DB9 connector and level shifter.
RS232 on Rig 200
Rig 200 supports 3 RS232 ports, two through DB9 connectors and another through pin headers.