Serial Debug Tool

Note: 15 February 2014. This has had some usefulness but was developed in response to a specific need. It may be useful as the basis for a more comprehensive tool for use where putty or minicom might be too clumsy to use.

This utility is a simple GUI serial testing tool using the QT framework and C++. Its purpose is to provide a means to compose a string of characters in ASCII or binary format, and transmit them at a specified baud rate to a target device. Any response is displayed in hexadecimal and ASCII form. This has been successfully used with the AVR microcontrollers to test the packet protocol and bootloader protocol. Doxygen documentation is provided.

The Tool begins by opening the PC default serial port /dev/ttyUSB0 (first Linux port for a USB) for use with a Prolific compatible USB-serial converter. This can be changed as necessary (for example to /dev/ttyS0 if you are using a classical serial port) by calling the GUI in a command line with the port specified as a parameter, or within the GUI at any time. The programmer communicates with the device using no parity, 1 stop bit and 8 bit data.

Usage

Select the baudrate from the drop-down box. The serial port can also be selected. Then enter the string into the line edit at the top of the window. Any printable character, including spaces, will be transmitted as plain 8-bit ASCII except for a backslash. This is used as an escape character. The two characters following will be interpreted as a hexadecimal representation of an 8-bit binary number. If these two characters do not form a valid hexadecimal number, the entire sequence of backslash and two characters will be transmitted as ASCII. A backslash alone can be transmitted by escaping it with another backslash.

A response from the target is displayed in two forms: a hexadecimal form and a printable ASCII form. If the binary number does not form a printable ASCII character, it is substituted by a dot. A maximum of 16 8-bit numbers can be displayed on a line. Note that the transmission and response are labelled on the left with a sequence number and that the most recent event is displayed at the top.

The transmitted line is displayed in the response box. This can be copied back to the line edit for retransmission by double-clicking on it. However the line is displayed as a binary string. The following image shows the tool communication with an AVRPROG type programmer or bootloader.


A button has been added to allow the string to be transmitted continuously with a delay in milliseconds between consecutive transmissions selectable by a spin box. The program must be killed to stop this process. This will allow oscilloscope observations of the send and receive lines.

Installation

Ensure that QT5, qt4-designer, qt5-qmake and under Ubuntu install libqt5serialport5-dev and libudev-dev to ensure that all libraries are present. To compile, unpack into a directory which by default will be serial-debug-tool. Execute:

$ make clean
$ qmake
$ make

This will build the application. Copy the binary to a suitable place and invoke with:

$ sudo serial-debug-tool

There is a command line parameter -P that allows a different default port to be specified, and -b that specifies a different baudrate.



First created 6 April 2010

Last Modified 14 February 2016