Bus Pirate: Custom UART Baud Rates

The Bus Pirate by Dangerous Prototypes is an extremely handy tool when working with (digital) electronics, for instance when prototyping to figure out how to use a new sensor or other peripheral chip.

It's cheap, at around US$30, and it's firmware is open source to you can contribute new features or bug fixes. I bought mine from Seeed Studio. Do some research before buying, as there are some different versions. Don't forget the probe cable.

Custom vs Standard Rates

When using the Bus Pirate in UART mode, you must specify the baud rate. Standard baud rates can be directly selected in the firmware's menu, but non-standard ones are trickier. The firmware doesn't support directly entering the desired baud rate, but instead requires you to enter the raw UXBRG register value which the Bus Pirate's Microchip PIC24FJ64GA002 CPU uses to achieve the desired rate. This can be rather annoying, since you must either look it up in the documentation yourself, or use third-party tools.

This page gives you two ways to figure out the proper value to enter to achieve a desired baud rate:

Because of how the baud rate is calculated, most register values result in a rather low baud rate. Since those rates are, in my opinion, very rarely used, the table is cut of at around 400 bps.

You can jump quickly to the part closest to each standard baud rate, using these links:

For each value, the error against the closest standard rate is also shown. Rates are considered "close" if the error is less than 7%. Note that for two UARTs to be able to talk, you need to consider the total baud rate error (for both ends of the connection), as well as the UARTs' characteristics.

UXBRG Calculator


FP = 16 MHz, BRGH = 1
UXBRG = (FP / (4 * )) - 1 = 0.
Actual rate = 0, error 0%.

UXBRG
Value
Rate Closest
Standard
Error