A primer on extending serial ports in embedded designs - Embedded.com

A primer on extending serial ports in embedded designs

Even with the advent to USB, the serial port refusesto die. With the term “serial port” we will usually mean the hardwaremore or less compliant to the RS-232 standard, or thecorresponding TTL signaling.

The serial port is easy to debug in the initial phase of hardwareand software integration. Many external devices still connect to theserial port even after advent of USB. Bluetooth modules, GPS modules,medical devices connect to one another by using serial ports for datatransmission.

In most of the embedded systems at least two serial ports areprovided. However, some systems need more that. So, this requires someway to extend the number of serial ports. Some of the choices availableto the designer include USB to serial port, I2C to serial port,Address/Data Bus to Serial Port (UART Controller).

A Serial Port Primer
From the hardware perspective a serial port has at least three pins ” aTransmitter, a Receiver and a Ground. Additional pins are used forhardware flow control and may or may not be used. In a typical embeddedsystem only three pins are used and there is no hardware flow control.

The classical Serial port uses a DB9 connector. The Pin out of these9 pins are shown in Table 1 below.

Table1: A Serial Port with DB9 connector

The typical voltage levels in RS-232 signal level is +12V and “12V.A voltage level of “12V indicates a logic high or 1 and a +12V voltagelevel indicates a logic zero or 0.

Serial Port in an Embedded System
Almost all embedded systems provide two or more serial port andtypically support TTL logic levels. The embedded system may need tointerface with two kinds of external devices, one that communicate atTTL level and another that communicates at RS232 levels.

If the device communicates at TTL level, the connection between theembedded system and external device is straight forward. But if thedevice needs RS232 level signaling, we will have to insert a RS-232Line Driver/Receiver between the processor and the device.

Most of the today's devices only need three wires Transmit Data,Receive Data and Signal Ground. No hardware flow control is used. Thissimplifies the hardware connection as well as the software design.

A Typical Embedded System
Figure 1 below shows a typicalembedded system using 4 serial ports. Port 1 of the embedded system isused for bootloader and debugging purpose. This port needs a RS232 LineDriver since it will be connected to desktop and/or laptop fordebugging purposes. Typically this port may be removed after theinitial spin of the board if the PCB board space is a constraint.

Port 2 has been used to communicate with a Bluetooth. Sincebluetooth device does not need RS232 level signaling, it has beenconnected directly to the embedded system.

Port 3 has been used to connect to a GPS (Global Positioning System)device. This device typically does not need RS232 level signaling, andtherefore, it has been connected directly to the embedded system.

Port 4 has been used to connect to a general purpose externaldevice. For example, an external RFID scanner. Let us assume that thisdevice needs RS232 level signaling. We will use a RS232 Line Driverbetween the embedded processor and the RFID scanner.

Figure 1: A typical Embedded System with 4 serial ports.

Depending upon the application, an embedded system may need morethan 4 serial ports. Some of these will need TTL Level signaling andothers will need RS232 level signaling.

Extending Serial Ports in EmbeddedSystems
Since most embedded system provide fewer than required number of serialports, the board designer has to find some way to extend the number ofserial ports. Fortunately, a number of options exist and the choicewill depend upon the level of comfort of designer has with hardwaredesign as well as the amount of additional software support.

USB to Serial Port. If the processor has a USB host, this will bethe best choice. The designer, for example, can add a 4 port USB Hub toan existing USB host. This will provide 4 USB ports. An example of theUSB Hub is Genesys Logic's GL850A IC.

The designer can, for example, use one of these four ports for USB,while other three can be used for extending Serial port. A USB toserial port bridge can be used for extending serial port. An example ofthe USB to serial port bridge is Prolific's PL-2303 IC. Figure 2 below shows an exampleimplementation.

Figure2: Extending Serial Port using USB Hub and a USB to Serial Port Bridge

The Prolific's PL-2303 gives the TTL logic level. If an RS232 levelis desired, an RS-232 Line Driver/Receiver should be used after theProlific's PL-2303 IC.

Usually the driver for the USB Hub as well as USB to Serial port ICare available, so there is very little software/hardware integrationissues.

I2C to Serial Port. In smaller microcontrollers, where USB port isnot usually available, an I2C to Serial Port converter is the bestchoice. Philips SC16IS752IPW is an example of I2C to Serial portconverter. Figure 3 below shows how to extend 4 serial ports from an I2C port.

Figure3: Extending the serial port using an I2C to Serial Port Bridge

There is, however, a speed limitation in these kinds ofimplementation. Because of limitations on the I2C bus side, there areno very fast serial ports. So this implementation works only if theserial ports needed are connected to an application that does not needblazing performance.

It is also worth noting that this implementation will require driverdevelopment on the software side. On balance, however, this is a goodscheme for small microcontrollers as well as some large microprocessorimplementations.

Address/Data Bus to Serial Port (UART Controller). Almost alwaysavailable no matter what the nature of the embedded system, is the theaddress/data bus to serial port (UART controller). It can almost alwaysbe employed in any processor system that has Address/Data bus support.

On the down site, for the functionality it provides it requires muchmore board space compared to some of the other alternatives discussedhere On the plus side, however, it almost always has the driver supportno matter what the platform. Philips Semiconductor's SC16C652IB48 UARTcontroller, for example, provides two serial ports.

Adding a small microcontroller. We can also add a smallmicrocontroller if we need to provide some functionalities in additionto the serial port. It can be useful to design a small microcontrollerthat will provide a number general purpose of functionalities to beused in many projects.

You should find a microcontroller that connects to the mainprocessor without sacrificing the available serial port. As an example,a main processor that connects using SPI and the small microcontrollerprovides two serial ports.

Some things to watch out for
The designer should not rely on extending the serial port afterdesigning the complete system. If there is a requirement for moreserial ports, attempts should be made to choose a processor that willprovide the required number of serial ports without using any add-oncircuitry. For example, Atmel's ATMEGA640V-16AU IC provides 4 serialport and is comes in the category of small microcontroller.

Also, be mindful of the fact that in most full fledged processorsthe first serial port is usually for the boot loader and the designershould try to leave it for debug purposes. Using the first serial portfor the application can pose additional difficulty to the designersduring the development phase.

Vikas Shukla is currently workingas Senior Design Engineer at BLHealthcare. He has degree in Computer Science and Engineering fromIT-BHU, Varanasi, India. Mr. Shukla has over 15 years of experience indesign of microprocessor-based systems. His expertise includes signalintegrity, architecture and design of remote patient monitoring systems .

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.