rs232 serial communucation ports 25 pin female and 9 pin male.
If you need to debug RS232 serial communications and are trying to decide on the best tool for the job this article can help you decide if an RS232 Analyzer, Serial Port Spy, or perhaps a combination of the two will be your best solution.

How to Debug RS232 Serial Communications

When working with RS232 serial communications the ability to view the data stream is important for a variety of situations. If you are developing a serial protocol an RS232 analyzer or serial port spy can save you hours of troubleshooting and if used from the start of your project gives you the ability to catch and correct problems early in the development cycle. Trying to reverse engineer or debug an RS232 protocol is virtually impossible to do without one of these tools.

But which tool is better suited for the job an RS232 analyzer or a serial port spy? Although both tools are extremely useful and allow you to debug RS232 data flows, they utilize different methods to accomplish this and each has its pros and cons. This article describes both approaches to help you pick the best tool for your situation.

RS232 Analyzer:

This classic approach utilizes software and hardware to provide a byte level view of the serial line. There are several different hardware/software options out there but typically this type of solution requires a specially wired cable and a PC with two available serial ports. The cabling is designed to tap on all the RS232 signals and utilizes the RX pins of the serial ports to correctly analyze bidirectional data.

This setup gives you a byte level analysis of what is physically occurring on the serial link. The RS232 analyzer records and time stamps the data, changes to the signal lines, and line status errors while the transmission is occurring. Since the data is being collected at the byte level you are able to inspect the inter character timing between events exactly as they were recorded on the line.

The benefit to this approach is that you can view exactly how the data was transmitted on the RS232 line along with the timings between events. An RS232 analyzer is the tool you want to use when you are in a situation where you need to prove who sent what. You can also analyze a link between any two RS232 devices including two embedded systems. The drawback is that you need to break your RS232 link to insert the cable which can be difficult if you are working with a remote user in the field.

Serial Port Spy:

This approach utilizes a special filter driver that inserts itself into the operating systems driver stack. Once inserted the filter driver can passively spy all data flows between any program running on the PC and one of its serial ports. This configuration allows for a logical view of how a program interacts with the Windows serial API. As such data is captured and time stamped at the packet level as it is passed to and from the API.

The benefit to this approach is that it is usually easier to configure and use. It also allows you to see things internal to the operating system that an RS232 line analyzer cannot such as calls to open and close the serial port handle, the process id of the program using the serial port, and the baud rate being used. It also allows you to debug a link in situations where physically tapping into the serial line is impossible such as internal modems or devices that connect to the PC via USB and utilize internal USBĖRS232 converters.

The drawback is that a serial port spy is limited to displaying only what a program reads or writes to the API. If for some reason your program decided to stop making read requests it might look like the remote device stopped transmitting when in reality the Windows program stopped listening. It also requires that one of the devices in your link be a Windows PC. You canít debug two microcontrollers with this type of tool.

Summary:

As you can imagine if you were to run both tools on the same link you would see two different views of the same protocol. The RS232 analyzer would show you the actual physical data flow while the serial port spy would display how the program got around to reading and writing the data.

In general an RS232 analyzer is better suited to tackle a wider range of problems since it displays what physically happens on the serial link but the convenience of a serial spy and its ability to give you a logical view of how your program is interacting with the Windows API is very beneficial to engineers who develop serial applications under Windows.

RS232 Analyzer

Ultra-Tap USB RS232 Debugger