Update, Saturday July 4th, 2009: All preorders are closed.
The Bus Pirate is a universal serial interface tool, we use it to test new chips without writing any code. It currently supports most serial protocols, including 1-Wire, I2C, SPI, JTAG, asynchronous serial, MIDI, and more. We added some other features we frequently need, like pulse-width modulation, frequency measurement, voltage measurement, bus sniffers, pull-up resistors, and switchable 3.3volt and 5volt power supplies.
The new v2 family adds USB power and connectivity to the best Bus Pirate design yet. We also reduced the part count and cost wherever possible. If you want to get your hands on some Bus Pirate USB goodness, Seeed Studio has assembled hardware for $30 (including worldwide shipping).
Read about the new design after the break.
The Bus Pirate connects to a PC USB port. The user send commands to the Bus Pirate from a serial terminal on the PC. Commands are translated to the bus protocols that control microchips. See our Bus Pirate page for full documentation.
The latest firmware supports 1-Wire, I2C, SPI, JTAG, asynchronous serial, MIDI, and PC keyboards. Bit-wise 2- and 3-wire libraries can interface most proprietary serial protocols. More protocols are being added all the time, check out the source code on our Google Code SVN page.
A Microchip PIC24F series microcontroller generates the user interface and translates input into bus communications. V2 uses the same 24FJ64GA002 as the previous Bus Pirate versions. It’s cheap, has a ton of memory, a couple 5volt tolerant input pins, and the peripheral pin select feature lets us assign hardware modules anywhere we want.
The PIC (IC1) is powered by a 3.3volt regulator (VR2, C23). Each PIC power pin gets a 0.1uF bypass capacitor (C1,2). The internal 2.5volt regulator requires a 10uF tantalum capacitor (C20). The programming pins are brought to a five pin header (ICSP) on the edge of the PCB.
The Bus Pirate is powered from the USB 5volt supply, which is first filtered with a ferrite bead (L1) and 10uF tantalum capacitor (C21). We used the small, still-not-quite-common, USB mini-b connector (J2).
Choosing a ferrite bead is a common hangup. Its purpose is to filter small power fluctuations, all the current for the circuit will go through it. We can guestimate that the Bus Pirate’s worst case current consumption is 525ma (3 power supplies @ 150ma, the FTDI chip @ 25ma, 2 LEDs @ 50ma max). Use a ferrite bead rated for at least 1000ma to be safe. We used this one, which is rated for 1500ma and costs 10 cents.
An FTDI FT232BL USB->serial chip (IC2) handles the USB connection. You might be familiar with this chip from various Arduino boards. FTDI has extensive driver support for most platforms, we used the virtual com port drivers. This is the latest generation chip, and it’s only available in small SSOP and QFN packages. We had no problem hand-soldering it to a professional PCB, but it’s not for everyone.
The FT232BL is powered directly from the filtered, unregulated USB supply. C4 is a decoupling capacitor for the FTDI232BL supply pin. A single LED (LED4/USB) indicates USB status and activity. The FT232BL RXLED pin sinks current, so we powered the LED from the 5volt USB supply through a 1.1K resistor (R3).
While the FT232BL runs at 5volts from the USB supply, its serial IO pins have an independent supply input – they can operate at another voltage. Since the microcontroller is 3.3volts, we just feed the FT232BL IO pins a 3.3volt supply and eliminate any funky translation circuitry. We used the chip’s internal 3.3volt regulator to supply the IO pins because it was the easiest trace to route. The IO pins get their own 0.1uF bypass capacitor (C5).
Switchable power supplies
The Bus Pirate has on-board 3.3volt and 5volt supplies (VR3, VR4) that can power a test circuit. The supplies are switchable, so we can reset the circuit from software when something goes wrong. To be extra safe, the supplies are held off until activated in the terminal.
[Nathan Seidle] at SparkFun recommended that we replace the TPS796xx ($2.50) we used in The Bus Pirate v1a with a MIC5205-xxYM5 ($0.90). They supply just 150ma maximum current, compared to 800ma from the TPS796xx, but the cost savings and reduced part-count are worth it.
The regulators are fed from the 5volt USB supply. The 5volt regulator drops a few millivolts below optimal because there’s no headroom, but it’s within the minimum level specified by most 5volt parts.
The MIC5205 requires a large output filter capacitor (C22-24, 10uF), but no input capacitor. An optional small-value capacitor on the BP pin can decrease power supply noise, but we left this off because it didn’t make much difference in practice.
A small voltage on the EN pin enables the supply, we used a 10K pull-down resistor (R18, not shown) to ensure that the supplies stay off while the PIC initializes. LED3/VREG, with current limiting resistor R32, lights when the power supplies are active.
On-board pull-up resistors
Bus Pirate V2 has multi-voltage, software controlled pull-up resistors via the 4066 (PDF) quad bilateral switch (IC3). When enabled, the 4066 connects the four on-board bus pull-up resistors (R20-23, 10K) to any external signal on the Vpullup pin (0 to 5volts). When disabled, the outputs are high-impedance and have no effect on the bus lines.
The 4066 can’t switch an input voltage greater than the supply voltage. To give it the widest possible range, we powered it from the USB supply (5volts).
When operated at 5volts, it takes 4volts+ to enable the 4066. The PIC pins have a maximum output of 3.3volts, so we have a problem. We solve it with a 5volt tolerant PIC pin and a pull-up resistor. We turn on the 4066 with a pull-up resistor to 5volts (R19, 10K), and then disable it by switching the connected PIC pin to ground.
For a brief instant at power-on, the PIC pin is high-impedance and the 4066 outputs are active because the pull-up resistor holds the control pins at 5volts. This is a concern if the Vpullup input is connected to an external 5volt supply while the bus is connected to a 3.3volt device – the brief exposure to 5volts might harm the device. If you’re worried about this, make sure there’s no active power supply connected to the Vpullup input before powering the Bus Pirate. This isn’t a concern if you use one of the on-board power supplies for the pull-up voltage because they’re disabled at startup.
Two voltage monitors measure the switchable power supply output. One measures the Vpullup input voltage, and another connects to the external voltage measurement probe.
Three LEDs indicate power, mode, and voltage regulator status (LED1-3). LED4/USB displays USB activity.
There are pads for resistors R30-32 and LEDs 1-3 on the front and back of the PCB. Only one set should be populated. We put pads on both sides so the board could be mounted with the indicator LEDs abutting the top of an enclosure.
V2a vs V2go
Bus Pirate V2a is a developer’s board. In addition to all the features of V2go, it includes a jack (J1) for an external power supply and an additional 5volt regulator (VR1). A switch (S1) selects between USB power and the external supply.
The FT232BL chip on V2a is powered directly from the USB supply, and is not connected to the external supply. This is useful if you want to disable USB and use the Bus Pirate with a serial port on a PC or PDA.
The V2a 4066 enable pull-up resistor is powered by the switchable 5volt regulator. The 5volt regulator must be enabled for the 4066 to be active. Don’t forget to install the 4066 pull-up resistor (R19), located on the back of the v2a PCB.
The PCB is a compact, 2-layer design. We prepared gerbers and had PCBs made by our usual service, BatchPCB ($21, shipped to EU), and tried a new service offered by Seeed Studio ($32, shipped worldwide).
Seeed has a PCB service specifically for open source hardware projects. For $32 (including worldwide shipping) we got 5 small PCBs, and Seeed made a few extra to sell in their shop. We liked the idea that there would be extra PCBs available.
You might know Seeed Studio from their cheap, improved Seeeduino Arduino clone. They’re located in Shenzhen, a Chinese electronics manufacturing hot-spot. A bunch of notable bloggers recently visited the region and wrote about the huge electronic component markets.
The Seed order arrived in 14 days (left), the BatchPCB order arrived in 30 days (right). Seeed and BatchPCB both make beautiful PCBs. Seeed has a much faster turn-around, and has better minimum trace widths and separation (8mil vs 6mil). BatchPCB has standard green PCBs, Seeed gives you the choice of green, black, or white; red, blue and yellow are $7.50 extra.
We really like the Seeed PCB service, extra Bus Pirate v2go and v2a PCBs from our order are available in the Seeed shop. BatchPCB remains the cheapest prototyping option if you want a single board, closed source work, or don’t mind the extra wait.
|VR2,3||MIC5205-3.3YM5 3.3volt regulator (SOT23-5)|
|VR4||MIC5205-5.0YM5 5volt regulator (SOT23-5)|
|C1-5||0.1uF capacitor (0805)|
|C20-24||10uF tantalum capacitor (SMC-A)|
|L1||1000ma+ Ferrite bead (0805)|
|R1||2000 ohm resistor (0805)|
|R3,30||1100 ohm resistor (0805)|
|R10-23||10,000 ohm resistor (0805)|
|R31,32||390 ohm resistor (0805)|
|J2||USB MINI-B (SMD)|
|I/O||0.1″ pin header (2×05)|
|ICSP||0.1″ pin header (1×05)|
|ST||0.1″ pin header (1×03) *unpopulated, optional*|
|Optional||Parts for V2a|
|C6-10||0.1uF capacitor (0805)|
|J1||2.1mm power jack (SMD)|
|R33,34,40||1100 ohm resistor (0805)|
|S1||Slide switch, SPDT, rt angle|
|VR1||LD1117s50 5volt regulator (SOT223)|
The biggest change in the latest firmware is the addition of a bootloader. Now the firmware can be updated through the USB or serial connection.
A bootloader is small program that sits at the beginning of the PIC program memory. It accepts updated firmware through the USB or serial port and saves it to the chip.
The bootloader comes from Microchip application note AN1157. We modified the bootloader to check for a jumper between the programming clock (PGC) and data (PGD) pins at power-up (update, above left). If there’s a connection, the bootloader takes over and waits for new code. Without a connection, the bootloader exits and runs the main program.
There’s a very minor chance of accidentally entering the bootloader with no jumper installed. This won’t damage the Bus Pirate, but you will need to connect it again. You can prevent it by moving the jumper over one position, between the ground pin and the inner programming pin (normal, above right).
Upgrading the firmware with the bootloader
If you’re upgrading, follow this procedure or refer to the instructions in the firmware download.
- Disconnect the Bus Pirate from any power supply such as the USB cable.
- Place a jumper between the programming data and clock pins of the ICSP header. This will trigger the bootloader mode.
- Connect the Bus Pirate to a USB port (or, if applicable, power and serial cable).
- Start the MS Windows P24QP.exe programmer utility. You may need to modify the COM port (portindex=) in P24qp.ini to match your system. Programmer source is available, and the simple bootloader protocol is documented in AN1157 if you want to write an app for a non-Windows system.
- Click the connect to device icon (#1). The program will connect to the PIC.
- Click the folder icon (#2) and open the firmware update file (vxx-Firmware for BL.hex).
- Click the erase device icon (#3) to erase the chip. DO NOT SKIP THIS STEP. Programming may not be successful if you forget to erase the chip.
- Click the write device icon (#4) to program the new firmware. Ignore any verify errors between 0×400 and 0xBFF, the bootloader lives in this region and doesn’t get updated.
- Click the green arrow icon (#5) to exit the bootloader and start the program. Click OK at the warning, we use the jumper to re-enter the bootloader.
- Remove the jumper from the programming pins, or move it over one position to connect the inner PGx pin to ground (GND).
- ***IMPORTANT*** Now restart the Bus Pirate by disconnecting and reconnecting the USB cable (or power cable). Some features won’t work until after a complete hardware reset.
USB device driver
You may need to install an FTDI virtual serial port driver for your platform.
On Windows, go to the Device Manager to configure the FTDI driver or check the COM port number.
Menus and Syntax
Use a serial terminal to communicate with the Bus Pirate. We like Tera Term.
The Bus Pirate works best with the terminal set to 115200bps, 8 databits, no parity, 1stopbit. Disable local echo in the terminal, and use CR for line breaks. Some modes also require Xon/Xoff software flow control.
- PWR indicates power to the Bus Pirate.
- MODE is off when the I/O pins are in a safe, high-impedance state. MODE is lit when a bus mode is engaged, the pins may be active.
- VREG indicates that the on-board switchable power supplies are active.
- UR is a single USB activity indicator LED. It displays data coming from the PC to the Bus Pirate. You can probably change what this LED displays with the FTDI configuration utility.
|Pin name |
||Description (Bus Pirate is the master)|
|MOSI||Master data out, slave in (SPI, JTAG), Serial data (1-Wire, I2C, KB), TX* (UART)|
|CLK||Clock signal (I2C, SPI, JTAG, KB)|
|MISO||Master data in, slave out (SPI, JTAG) RX (UART)|
|CS*||Chip select (SPI), TMS (JTAG)|
|AUX||Auxiliary IO, frequency probe|
|ADC||Voltage measurement probe (max 6volts)|
|Vpu||Voltage input for on-board pull-up resistors (0-5volts).|
|+3.3v||+3.3volt switchable power supply, max 150ma|
|+5.0v||+5volt switchable power supply, max 150ma|
|GND||Ground, connect to ground of test circuit|
Notes: * TX moved from CS to MOSI in firmware v0g.
The 10 pin I/O block contains the data signals and power supplies that connect to a test circuit. Each pin is labeled on the back of the PCB, refer to the table above for a detailed description.
The pinout on V2 is similar to V1, but we moved the power supply output and Vpullup input to the cable bundle. We also eliminated the second, unused auxiliary pin.
If you want a complete Bus Pirate or a kit, here’s a couple options:
- Seeed Studio is accepting pre-orders for assembled Bus Pirate v2go hardware until the end of Friday, July 3. An assembled Bus Pirate v2go is $30, including worldwide shipping.
- Seeed Studio also has the extra v2g0 ($5.90) and v2a ($6.50) PCBs from our order.
- Fundamental Logic sells a through-hole kit version of the Bus Pirate V1a ($29.50). ***v1a is serial port only***
Thanks to everyone who contributed to this project. The Bus Pirate wouldn’t be possible without a ton of great feedback from the comments. If you’d like to get involved, join the Bus Pirate project at Google Code.
Hack a Day review disclosure: We asked Seeed Studio to make our first order of PCBs for free. Since then, we’ve made several paid orders.