Working with serial port projects

From DP

Jump to: navigation , search



We do a lot of testing with serial terminals, this will be a tutorial about probing different projects with various utilities.


Virtual COM port over USB

Modern day commuters rarely have a hardware serial port, but they all come with USB. Making software work with USB, even the simplest HID class is complicated, and requires hardware specific drivers.

As a workaround there is the virtual COM port over USB. This allows your USB device to appear to the operating system as a simple COM port. This gives you the simplicity of the serial port in modern computers.

Since the serial port as been around for decades, there are many great apps, and hardware that can take advantage of this.


Here we we'll run trough a few examples on how to use the COM port to communicate with some of our hardware. Grab some terminal software like Tera Term, and Hercules and follow along.

-Terminal software are apps which allow you to send and receive characters from the serial port.

Bus Pirate

The Bus Pirate interface is designed to be used with simple serial port terminal software. Where the Bus Pirate literally prints out the menu into your terminal, and you respond back by typing in characters into the same terminal.

We'll start out by opening the appropriate COM port in our terminal software. For more information on how to get to this point look here. Once you have connected to the Bus Pirate, hit Enter. The Bus Pirate should respond by writing 'HiZ>' in your terminal (as in the picture above). this lets you know that the Bus Pirate is in the high impedance mode, and all it's pins are disconnected from the target.

Hit 'i' to get the Bus Pirate to print out information about itself on your terminal. You should be able to read the version of the hardware, firmware, and the bootloader you have.

To get the list of all the commands for the Bus Pirate hit '?'. This prints out the full list of Bus Pirate commands in the terminal, reminiscent of old command prompt help.

The Bus Pirate also has a raw binary mode. In this mode the serial port and the Bus Pirate communicate in raw binary date, instead of the ASCII characters used by the terminal. This mode is implemented so scripts, and software could take control of the Bus Pirate without having to use cumbersome ASCII letters to communicate.

To enter the Binary mode of the Bus Pirate you'll need to either write a custom scrip that can send binary values to the serial port, or use the software Hercules which has this option. In this example we'll use Hercules.

Open the COM port the Bus pirate is located on. Now to enter the Binary mode you need to send 10 bytes all with the value of 0. Remember this is not the ASCII 0, which actually has a byte value of 48 (decimal base).

Once you send this the Bus Pirate will respond with 'BBIO1', meaning Bit Bang IO mode version 1.

From here your script has control of the Bus Pirate. For example to enter the I2C mode, all you have to do is send the single byte with the value 2. Once the BP receives this it will respond with I2C1, or I2C mode version 1.

For further information you can check out our documentation on the Bus Pirate Binary mode.

Open Bench Logic Sniffer


Video and further information