Skip to main content

UART Protocol Commands

Overview

  • Bus: UART, MIDI (universal asynchronous receiver transmitter)
  • Connections: two pins (RX/TX) and ground
  • Output type: 1.65-5volts. Powered by onboard supply or an external voltage on the VOUT/VREF pin
  • Maximum Voltage: 5volts
info

UART is also known as the common PC serial port. The PC serial port operates at full RS232 voltage levels (-13volts to +13volts) though, which are not compatible with the Bus Pirate.

Connections

Bus PirateDirectionCircuitDescription
TXRXBus Pirate Transmit
RXTXBus Pirate Receive
GNDGNDSignal Ground

Connect the Bus Pirate transmit pin (TX) to the UART device receive pin (RX). Connect the Bus Pirate receive pin (RX) to the UART device transmit pin (TX).

Configuration options

Bus Pirate [/dev/ttyS0]
UART speed
1200, 2400, 4800, 19200, 38400, 57600, 115200 etc
x. Exit
Baud (115200*) >
Data bits
5 to 8 bits
x. Exit
Bits (8*) >
Parity
1. None*
2. Even
3. Odd
x. Exit
Parity (1) >
Stop bits
1. 1*
2. 2
x. Exit
Bits (1) >
Actual speed: 115207 baud
Mode: UART
UART>

Syntax

CommandDescription
[Open UART, use r to read bytes.
{Open UART, display data as it arrives asynchronously.
] or }Close UART.
rCheck UART for byte, or fail if empty. (r:1…255 for bulk reads)
0bWrite this binary value. Format is 0b00000000 for a byte, but partial bytes are also fine: 0b1001.
0xWrite this HEX value. Format is 0x01. Partial bytes are fine: 0xA. A-F can be lower-case or capital letters.
0-255Write this decimal value. Any number not preceded by 0x or 0b is interpreted as a decimal value.
spaceValue delimiter. Use a space to separate numbers. No delimiter is required between non-number values: {0xa6 0 0 16 5 0b111 0xaF rrrr}.
(#)Run macro, (0) for macro list.

Commands

Bus Pirate 5 has global commands available everywhere, and mode commands specific to the currently selected mode. Type help to see all commands in every mode, or help mode for the currently available mode commands.

tip

Most Bus Pirate commands have help. Add the -h flag to any command to see the latest available options and usage examples.

bridge

Transparent UART bridge. Bidirectional UART pass-through to interact with other serial devices from inside the Bus Pirate terminal. Press the Bus Pirate button to exit.

Help

Bus Pirate [/dev/ttyS0]
UART> bridge -h
usage:
bridge [-h(elp)] [-t(oolbar)]
Transparent UART bridge: bridge
Exit: press Bus Pirate button

open UART with raw data IO, usb to serial bridge mode
-t ENABLE toolbar while bridge is active (default: disabled)
-h Get additional help

UART>
tip

Use bridge -h to see the latest options and features.

gps

Most GPS modules output NMEA sentences through a serial UART. The gps command decodes common sentences using minmea. The raw data and decoded data are printed in the terminal. Press any key to exit.

Help

Bus Pirate [/dev/ttyS0]
UART> gps -h
usage:
gps [-h(elp)]
Decode GPS NMEA packets: gps
Exit: press any key

parse NMEA GPS data
-h Get additional help

UART>
tip

Use gps -h to see the latest options and features.

MIDI

MIDI is a command set used by electronic (music) instruments. It travels over a standard serial UART configured for 31250bps/8/n/1.

MIDI is a ring network, each node has an input and output socket. Each node passes messages to the next in the ring. The input and outputs are opto-isolated. The signaling is at 5volts, 5ma (current-based signaling). An adapter is required: example 1, example 2.