RS232 Interfaces

RS232 Interfaces

Let's review serial port connections as they are defined by the RS232 standard. This standard has been around for many years and was developed to define connections, signal levels, handshaking for data flow synchronization, and data rates for terminal and communication devices. The Standard consists of two parts: the RS232 Interface Standard and the RS232 Protocol Standard. The interface defines the plug and socket, signal levels, and the name of each pin. It is used extensively in amateur radio.  The protocol standard defines handshaking for data flow control; it is ignored, that is not used,  in most amateur radio software programs. Consequently, the Data Terminal Ready (DTR) and Ready To Send (RTS) signals are not used for data flow control and can be used for other things, like PTT and CW keying.

There are two types of RS232 devices. These are Data Terminal Equipment (DTE) and the Data Communication Equipment (DCE) devices.

DTE and DCE Devices

Figure 1 shows two RS232 devices connected with a "straight-through" cable. A DTE was originally a terminal that connected to a remote computer via a modem, which was called a Data Communications Equipment (DCE) device. Nowadays, the DTE device is your computer. It has been a convention, since the early days of personal computer development, to configure the computer as a DTE device. For ease in manufacturing cables, electronics manufacturers of devices to be connected to a personal computer normally choose to make the device conform to the DCE standard. This means a "straight through cable" is used. If two DTE devices are to be connected, a "null modem" or "cross-over" cable must be used as shown in Figure 2. The K3 is configured as a DCE device and so a straight through cable, also called an RS232 cable or serial cable, is used to connect to a computer.

Transmitted data is an output on a DTE device and an input on a DCE device.


Notice in Figure 1 that the serial data pin names, TxD (Transmitted Data) and RxD (Received Data), and their signal flow directions, are defined in reference to the DTE device. That is, TxD is transmitted data and is an output from the DTE device. Perversely, it seems, the TxD name is used for an input signal on the DCE device. The has caused a great deal of confusion amongst amateurs trying to hook up serial devices. An invaluable tool for troubleshooting RS232 connections is a "blinky box" tester shown in Figure 5.

The signals RTS and DTR stand for Request to Send and Data Terminal Ready. In the original RS232 definition they, along with other handshaking signals, helped control the flow of serial data between the DTE and DCE device. In the K3 the RTS and DTR signals from the computer may be used to provide push-to-talk (PTT) and CW keying signals.


 Figure 1.  RS232 serial interface DTE and DCE devices.

Figure 2.  RS232 DTE to DTE null modem cable.



RS232 Electrical Signals

RS232 signals need to be converted to TTL when connecting a computer serial port to a logic device.


Computer logic circuits operate with low DC voltages, usually 5 volts or less. A logic 1 may be +3 v and logic 0, zero volts. The RS232 logic signals are greater than this to reduce the chances of noise, induced into long cables that were often used by telephone companies to connect a DTE to a DCE device, from corrupting the data. See Table 1. This means you must not connect a computer's RS232 serial output to your radio unless the manufacturer, such as Elecraft, has provided RS232-to-logic level conversion. You may remember that in some earlier radios this conversion function was supplied by an external interface box. You do not have to provide any external voltage translation to hook your computer's serial port to the K3's RS232 serial port, but you do when connecting to the ACC port.

 

Table 1.  RS232 voltage levels.

 

Logic State

 

0

1

Computer Logic

0 v

+3, +5 v

RS232

+3 to +25 v

-3 to -25 v

 

Serial Data Format

Eight bits of data (a byte) are sent by converting them from a parallel form to serial by parallel-in/serial-out shift registers in the electronics of the computer and in the K3. The data can be any 8-bit code, but early applications of the RS232 interface used a 7-bit ASCII code to send and receive alphanumeric characters. Because the ASCII code uses only seven bits, the eighth bit was designated a parity bit to detect if errors occurred in the data transmission. Figure 3 shows how a byte of data is sent. It starts with a start bit, which is followed by eight bits of data and a stop bit to signify the end of the byte. In some early systems using teletypes, more than one stop bit was needed, but the K3 protocol uses only one. The K3, however, uses all eight data bits and thus there is no parity bit.  (The cable connecting your K3 to  your computer is generally short and well-shielded  enough to make errors very unlikely.)


Figure 3.  Serial data transmission.

 

Serial Data Rate

Because the serial data are shifted out of the transmitter and into a receiver, the data rate (bits/second, or baud) for the shifting action must be the same in both the transmitter and the receiver[1]. The standard rates accepted by the K3 are shown in Table 2 and your computer program and the K3 must be set to the same rate.

Table 2.  K3 serial port data rates.

K3 Data Rates

bits/sec (baud)

4,800

9,600

19,200

38,400

 

The Universal Serial Bus (USB)

The RS232 serial port is a vanishing feature in laptops and desktop personal computers. It is being replaced by USB ports that allow a wide variety of external devices such as printers, memory sticks, etc to be easily connected to your computer. If your computer has replaced serial, or so-called Com ports, with the more modern USB ports, you must use a USB adapter to connect to the RS232 interface used on the K3. There are several chip-sets used in USB adapters. Some work better than others and all require drivers suitable for the operating system on your computer. Elecraft offers a USB adapter that uses the FTDI chipset and has been tested to work with the K3.

One of several issues with USB-Serial adapters is that each time a computer's operating system is changed, the adapter manufacturers may have to provide a driver for that new system. Thus, an adapter that works on Microsoft XPÔ, say, may not work well with a new operating system such as Windows 7Ô. Furthermore, some software programs, although compiled to run on any operating system, may have problems with the conversion interface between a call to a serial interface driver and a USB driver. Another issue is that the USB is not regulated by an IEEE Standard. Consequently, USB devices from various manufacturers may not talk to one another correctly.

Elecraft designers have chosen to provide an RS232 interface in the K3 instead of a USB interface. By doing this they avoid the headache and software development expense of maintaining a USB interface in a constantly changing, unstandardized operating system environment.

 

Getting Your Serial Interface to Work

Use a Computer with a Real Serial Interface

The very best way to connect your K3 to your computer is to use a computer with a native, real RS232 serial port. Many desktop computers still have RS232 COM ports and if they do not, plug-in serial ports are readily and inexpensively available. A board that can plug into a desktop computer with four RS232 ports costs about $50 US.  You can also purchase RS232 serial ports that can plug into a laptop's PC (PCMCIA) card slot. Otherwise, if your computer has only USB connectors, you will need a USB-to-Serial adapter.

Eliminate all other Interfaces

Remove all other interfaces between the computer and the K3 except for the USB-Serial adapter. This is particularly important when updating firmware and configuration files where data transfer timing is important.

Start from Scratch

Turn off both the computer and the K3. Then turn the computer on, and after it has completely booted up, turn on the K3.

Find out what COM Port the Operating System has Assigned to your Adapter

One of the easiest ways to find the COM port number is to use the K3 Utility program. It does a good job of finding the active COM ports. Here is a procedure using with the K3 Utility program that can help you find the COM port number.

1.     Run the K3 Utility program and open the "Port" tab.

2.     Click on "Refresh Port List" so that the K3 Utility program knows what COM ports are available.

3.     Choose a serial port to connect to the K3.  The Utility will attempt to make contact with the K3. If it fails, chose another port.

4.     When a connection is made, you will see a status message window pop up showing you the MCU firmware version, the COM port in use, and the RS-232 speed. The K3's baud rate will be set to 38400 bps.

5.     Click on OK.

You can also check the computer's control panel to find COM port settings.

1.     Go to the computer's Control Panel (usually Start ® Settings ® Control Panel) and click on System.

2.     Open the Device Manager (under the Hardware tab) and click on the "+" next to Ports (COM & LPT).

3.     You should see the COM ports that are active in your computer. See Figure 0‑4. In this case, COM5 is the port using a Prolific USB-to-Serial Bridge connecting to the K3.


Figure 4. Device manager showing the COM ports.

 


 

Use an RS232 Tester, or "Blinky" Box

Figure 5 shows an inexpensive and very useful RS232 test device. Its bi-color LEDs (red and green) show the mark and space logic levels, and you can very quickly tell which of the RS232 devices is operating and which is not. Some USB-Serial adapters have LED indicators built in for TxD and RxD. Here is a procedure to troubleshoot your serial connection.

1.     Disconnect the K3 from the computer COM port or USB adapter.

2.     Connect the tester to the computer COM port or to the USB adapter.

3.     If the COM port RS232 interface is activated, you should see the TxD LED light up. It may be flashing if the computer is trying to send data to the K3.

4.     Now disconnect the computer end and connect the tester to the K3's RS232 port. You should see the RxD LED light up. It may be flashing if the K3 is trying to send data to the computer. Try rotating VFO A. The K3 will try to send frequency information to the serial port.

5.     If the computer has lit the TxD and the K3 the RxD LEDs, you can be assured that the cable is a straight-through RS232 cable and you can continue with further tests. If there is any conflict, both lighting up TxD, for example, the cable is a null modem cable and you must replace it with a straight cable.

6.     If your computer software uses RTS and DTR for PTT and keying, you may see these LEDs be active too.

If TxD does not light up and flicker, there must be a problem at the computer end. It may be a problem with the USB-Serial adapter driver or the cable. The RxD LED should be active and should flicker when you turn the K3's VFO. If it doesn't, look for a problem in the serial cable. You can often diagnose cable problems by putting the blinky box successively on either end of the cable. If both TxD and RxD are flashing, the serial port is probably OK and the problem is likely that the data rates are not the same in the computer software and the K3.

  Figure 5. RS232 tester. 

 

 

Check the Data Rate, Data Bits, and Parity

These settings must be identical on the K3 and in your software. The K3 always uses 8 data bits and no parity. Its data rate is set in the CONFIG:RS232 menu.

Try Using a Slower Data Rate

Although the K3 can send and receive data at 38,400 bps, some computer programs may not be able to transfer data that fast. You might try a lower RS232 setting. Make sure you set both the K3 and your software to the same data rate.

Updating Drivers

Whenever you update or change to a new operating system, you may have to update the driver for your USB-Serial adapter. Go to the chip-set manufacturer's web site. For example, the web site for the FTDI chip-set in the KUSB from Elecraft is http://www.ftdichip.com/FTDrivers.htm. The Elecraft web site also maintains drivers for this chip-set and for the older Proflic chip-set devices. Download the driver for your operating system and follow any installation instructions. You can always uninstall a driver from the system hardware console Device Manager.

Turn Off the USB Port's Power Save Option

The operating system has the ability to turn off a USB port's power to reduce power consumption and extend battery life in laptops. It may do this if there hasn't been any activity on the port for some time. This can cause havoc with your USB-Serial port because it can take some time for the adapter to power-up and to be initialized for use. There are various web sites that describe how to turn this feature off.  Here is just one: http://www.guidenet.net/resources/usb.html.

Getting Rid of Unused COM Port Assignments

A frequent occurrence when trying to find an unused COM port to connect to the K3 is that many appear to be in use. The Windows operating system uses several COM port I/O addresses at times and, among other things, is not very good at releasing the resource for other uses. You can usually safely free up these COM ports with the procedure described at:

 http://www.ehow.com/how_7334056_delete-serial-_com_-ports.html.

 



[1] Baud is a contraction of the surname of an early pioneer in serial data communications, J.M. Baudot. Baudot invented a 5-bit code for sending data in a telegraph system, which was adopted by the French telegraph system in 1877 and became one of the standards used for international telegraph communication.