Recently, while blogging on the Raspberry Pi computer board, I’ve been reminded of the importance of paying attention to serial port voltage levels. While voltage levels are a general consideration for all electronics, I’ll just talk about RS-232 voltage levels, since speaking of voltage levels can be a bit tricky particularly with RS-232.
Taking the Raspberry Pi as an example, we have a device that has a UART, but note: having a UART is not the same as having an RS-232 COM port, for several reasons. First, the RS-232 COM port has a reasonably well-defined connector; second, the RS-232 COM port offers specific control lines beyond TX, RX, and GND that may or may not be implemented in a given UART’s design; and third, an RS-232 COM port operates at signal specific voltages that are not necessarily the signal voltages of a given UART.
So, although the Raspberry Pi has lines that are documented as TxD, RxD, and GND, these are not actually RS-232 serial lines until, at the very least, they have been made to match the voltages RS-232 defines.
And what are those voltages? RS-232’s data signalling voltages, consisting of a sequence of logical “ones” and “zeros”, are the voltages that correspond to those logical values. The region from +3 volts to +15 volts is defined as a logical “zero”, and the region -3 volts to -15 volts is defined as a logical “one”. The middle region between these two regions is essentially a no man’s land, as far as RS-232 is concerned. For the RS-232 control lines (DTR, DCD, DSR, RI, RTS, CTS) these designations are reversed: a logical “zero” is in the negative range and a logical “1” is in the positive.
But since the circuitry of the Raspberry Pi (as well as that of many other electronic devices) is actually operating in the range of 0 to +3 volts, circuitry to translate those logical values to the signalling voltages of RS-232 is needed. A word of advice here to tinkerers who think they can simply connect the TxD of their computer’s RS-232 port to the RxD line of their Raspberry Pi (or similar device) and vice versa: DON’T. You will quite possibly cook the device’s internal electronics.
The converse is also true: the voltages output from some electronics (even those sometimes called “RS-232”) are not automatically enough to do the job, depending on cabling runs, the data rates, and the specifics of the serial peripheral involved.
That’s where LAVA pays particular attention in its RS-232 designs: they take care to supply the full voltage required by all RS-232 peripherals; not all competitors do the same.
Finally, while are are talking about voltages, there is the ground line in RS-232. Along with the transmit and receive lines it’s by definition always there, and when speaking of plus or minus amounts of voltages as we have been doing, we are implicitly referring to some standard. In the case of RS-232, this standard is the ground line, which is assumed to be 0 volts. That’s great, but the 0 voltage of the ground line is expected to be the same zero at both ends of a serial connection. For that reason, RS-232 connections share a common ground (unlike the differential signalling of RS-422 or RS-485, to mention a couple of other serial standards). There is good news and bad news in using a common ground as the reference. The good news: only three lines are required for RS-232 transmission. On the down side: RS-232 has a relatively short reliable cable length compared to methods requiring at least four lines, like RS-422 and RS-485, or USB 3.0 for that matter. More on those technologies can be found here (RS-422 and RS-485) and here (USB 3.0).