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).
We’ve just launched a new version of our DSerial-PCIe. This version is the DSerial-PCIe/LP (our low profile PCIe card), but fitted with a full-height bracket. The advantage is that the fan-out cable used on the low-profile version is now available on a full-height PCIe card. For those wanting the flexibility of a cabled solution for PCIe expansion, this card fits the bill.
The features of this new card include:
• Form factor: 1x. Will fit into any PCIe slot.
• Form factor: Full-height PCIe card.
• Bracket: Full height [FH]
• Cable: Two port RS-232 DB-9 fan-out
• Driver support: Standard
• Serial support: RS-232, 115.2 kbps, 16550 UART
• LAVA Lifetime Warranty
You can read the details in our press release.
This blog posting on the Raspberry Pi serial ports goes into a bit more detail than the last post on Raspberry PI serial interfacing, as it compares the two serial ports the Raspberry Pi has and looks more closely at the characteristics of the second serial port available on the Raspberry Pi.
Of course, for those intending to use the Raspberry Pi as an embedded SBC more serial ports might be desirable. In that case, they could be added using the USB connector and and USB-to-serial adapter.
However, the Raspberry Pi has serial ports of its own. The first serial port, the “Mini UART,” was discussed in the last Raspberry Pi blog post, and it can basically be seen as a console port for access to the Raspberry Pi.
The second serial port is a more fully-implemented version of the 16C550/16C650, with more hardware lines available and with greater configurability for buffers and flow control. It is a version of the ARM PrimeCell PL011 UART. The details of the two ports are shown in the following table:
The PL011 UART varies from the industry-standard 16C650 UART device as follows:
• Receive FIFO trigger levels are 1/8, 1/4, 1/2, 3/4, and 7/8
• Transmit FIFO trigger levels are 1/8, 1/4, 1/2, 3/4, and 7/8
• The internal register map address space, and the bit function of each register differ
• The deltas of the modem status signals are not available.
The following 16C650 UART features are not supported:
• 1.5 stop bits (1 or 2 stop bits only are supported)
• Independent receive clock.
The following functionality of the ARM PrimeCell UART (PL011) is not supported in the Raspberry Pi implementation:
• Infrared Data Association (IrDA)
• Serial InfraRed (SIR) protocol Encoder/Decoder (ENDEC)
• Direct Memory Access (DMA).
In most applications these differences will not matter, as the largest part of serial peripherals do not use all the signalling implemented on full-blown serial ports.
Hooking up a serial port on the Raspberry Pi’s GPIO has one complication that needs to be borne in mind: the voltages on the GPIO pins are not in the range of those required for conventional RS-232, RS-422, or RS-485. Specifically, the GPIO pins supply “logic level” signalling, at about 0v to 3.3v.
Since RS-232 looks for levels of -5v to -15v for a logical “1,” and +5v to +15v for a logical “0,” the outputs from the Raspberry Pi would also need a level shifter circuitry (like the MAX3232CPE chip [ED. NOTE: I have revised this to include info supplied in comments below]) to generate the appropriate voltages.
If you wish to generate RS-422 or RS-485 signalling, then a line driver like the SP3485 is required.
GPIO pin assignments
The serial I/O on the Raspberry Pi pin header is as follows:
CM2835 ARM Peripherals specification sheet (Broadcom BCM 2835 specification sheet: the core of the Raspberry Pi)
PrimeCell® UART (PL011) Revision: r1p4 Technical Reference Manual (PrimeCell UART (PL011): the UART in the Broadcom BCM 2935)
http://www.raspberrypi.org/forum/general-discussion/gpio-pinouts-confirmed/page-3 Raspberry Pi forum discussion on serial implementation for the Raspberry Pi)
Raspberry Pi production build schematics (NOTE: GPIO pin assignments have varied in the pre-release history of the Raspberry PI. Please confirm current pinouts before implementing serial I/O on the Raspberry Pi.)
Farnell has a Quickstart Guide that discusses serial connection to the Raspberry Pi (NOTE: Take care when connecting that you are not sending a higher voltage into the Raspberry Pi than it can handle; this Quickstart Guide is not explicit on this point)
From backyard weather stations to nation-wide integrated systems, the Internet has transformed the collection, analysis, and distribution of weather information. By their nature, weather stations are geographically scattered, and yet there is great value in consolidating the information that they collect. For this reason, many weather stations have the capability of outputting thier data to a computer system or modem.
LAVA Ether-Serial Links can play a role in either eliminating the need for a computer near the weather station, or can make it possible to eliminate phone line/modem connectivity, or costly cellular modems.
The usual arrangement is having the weather station connect to a computer, either directly on serial, USB, Ethernet, or through a modem. An Ether-Serial Link (or other serial device server) can cost-effectively streamline the process, eliminating the modem/phone line connection, or even eliminating the computer itself.
LAVA has written an application note that takes the users of Davis Instruments weather stations through the steps of getting those devices on the Internet; the overall concepts apply to other manufacturers’ weather stations as well.
Once online, your weather station can contribute to the many individually operated weather stations feeding data in to systems like the Weather Underground.