Bus Pirate v4 design overview
From DP
Bus Pirate v3, and all previous Bus Pirates, are based on a chip with 64K of program space. Last year we stuffed so many features into the firmware that we used all the space. It was time for new hardware based on a new chip.
We didn't want to run out of space again soon, so we used a PIC 24FJ256GB106 with 256K of space. More room was the main goal, but we can pull off some other fun things with the resources on the bigger chip:
- Integrated, on-board USB (faster)
- Data storage EEPROM to hold settings
- Pull-up voltage selections: 3.3volt, 5volt, or external supply
- 2 extra I/O pins
- Multipurpose button
- Bus Pirate v4 vs v3 comparison
Bus Pirate v4 is new and shiny, but it will lag behind the trusty v3 for a while. If you want proven goodness we still recommend the v3, it is actively developed and will be manufactured for the foreseeable future. v4 will continue to improve, and we'll let you know when we think it is the go-to hardware.
You can get a Bus Pirate v4 for $40, including worldwide shipping.
Read about the design below.
Contents |
Overview
Small sensors and other microchips talk many different protocols (1-Wire, I2C, UART, SPI, etc) through different numbers of wires. The Bus Pirate is a simple way to talk to many of them from a computer. Commands typed into a computer are sent to the chip, any reply is displayed on the computer screen.
The Bus Pirate speeds up development when you're working with a new chip. It's a known-working (usually) reference implementation of a protocol, and you can use it to learn a new chip before writing any code. It also has a ton of other stuff we need all the time like power supplies, voltage and frequency measurement, pull-up resistors, and more. The code is all public domain, so you can reuse it in your own project without restrictions.
We hacked the Bus Pirate together as we worked on different projects. Each feature was added because it solves a real-world problem. Hundreds of contributors have made the Bus Pirate one of the best known open source hacking tools. Thank you to everyone who contributed to the development of Bus Pirate v4.
Hardware
Click for a full size schematic image. Schematic and PCB were designed with the freeware version of Cadsoft Eagle, download the latest project files from our Google Code project page or look for a release package.
PIC24FJ256GB106
Bus Pirate v4 uses a beefy PIC24FJ256GB106 microcontoller (IC1). It has 4 times more storage space, and twice the memory of chip used in Bus Pirate version 3. On-chip USB speeds up the data connection considerably, and gives optional USB On-the-Go capability.
A 3.3volt regulator (VR1) powers the PIC from the 5volt USB supply, it needs a 1uF capacitor (C12) to stabilize the voltage output. All the PIC power supply pins (VDD) are decoupled by 0.1uF capacitors (C2,C4,C9). The PIC has an internal 2.5volt regulator that powers the core, it needs a 10uF capacitor (C15) on the VCORE pin.
The PIC runs at 32MHz/16MIPS. A clock is supplied by an external 12MHz quartz crystal (X1) and two 18pF capacitors (C7 and C8). The core gets 32MHz by multiplying the external clock to 96MHz, then dividing it by three.
Code is loaded into the PIC chip through the ICSP programing header. as well a reset button. 2K resistor R7 holds the MCLR pin high so the PIC operates normally. The RESET button momentarily pulls MCLR low to reset the PIC.
USB
Version 4 uses a PIC uC with an on-board hardware USB module, instead of the dedicated FTDI USB-to-serial chip we used in previous versions. On-board USB means the Bus Pirate can interface with a computer at a much faster rate.
The board was designed for USB On-the-Go capability - it can be used as a USB OTG development board. You will need to solder the external supply header (JP1) and the rectifier diode (D3).
IO header
| PIN | NAME | PIN | NAME |
|---|---|---|---|
| 11 | SWV50 | 12 | GND |
| 9 | VEXTERN | 10 | SWV33 |
| 7 | AUX2 | 8 | ADC |
| 5 | AUX0 | 6 | AUX1 |
| 3 | MISO | 4 | CS |
| 1 | MOSI | 2 | CLOCK |
The Bus Pirate connects to devices through a 12 pin IO header.
v4 has two new pins (AUX1, AUX2), both are extra generic IO pins. They will eventually be accessible from all modes, and may have frequency generation/counting, secondary serial interface, logic analyzer, and other features.
Switchable power supplies
The Bus Pirate can power small circuits at 3.3volts and 5volts. VR2 supplies 3.3volts, VR3 is a 5v supply. Both use 1uf capacitors (C11, C13) to stabilize their outputs.
Both power supplies are enabled by a microcontroller pin. When the Bus Pirate starts they are off - any attached circuit is safely powered-down. Use the 'W' command in the Bus Pirate terminal to turn on the supplies. The VREG LED will light.
Pull-up resistors
Several common electronics interfaces need a resistor between each pin and the power supply. These pull-up resistors create the high/1 signal on a high-impedance bus. Pull-up resistors are also a common way to interface electronics at different voltages.
The Bus Pirate has pull-up resistors on the four main data pins. They can be enabled in software with the 'P' command. MISO, CLOCK, and CS have 10K pull-ups through a resistor array (RN1). MOSI has a 2K resistor (R10) to support certain bus-powered 1-Wire devices. Power to the pullups is controlled through a 4066 quad analog switch (IC2).
Switchable pull-up voltage
New in v4 you can select between three pull-up voltage sources from software. Power for the pull-up resistors can come from the 3.3volt supply, 5volt supply, or an external source. The pull-up source is set in the user terminal with the 'e' command. This is a new feature, version 3 only uses an external pull-up supply.
Two PNP transistors (Q1,Q2) toggle the voltage source between the on-board regulators. R13 and R14 hold the transistor base high so current can flow, a PIC pin holds it low to keep them off. Diodes D1 and D2 keep current from flowing back through the transistor.
Voltage monitors
The USB voltage, on-board power supplies, pull-up voltage, and ADC probe are all monitored through a voltage divider. Two 10K resistors (RN2, RN3) allow the 3.3volt PIC to measure up to 6volts safely. For extra protection, the Bus Pirate monitors the voltage regulators and can disable them if a short circuit is detected.
LEDs
There are 4 LED on-board the Bus Pirate v4, each has a 1K1 current-limiting resistor (R3, R4, R5, R6). The PWR LED is connected to the MCU power supply. The VREG LED is connected to the 3.3V switchable power supply. USB and MODE are driven by the MCU.
On-board EEPROM
New in version 4 is an on-board 24xx64 8Kbyte data storage EEPROM (IC3). It will be used to store various settings and preferences. The EEPROM's I2C interface can be accessed by the Bus Pirate's I2C mode - first time users can get familiar with the Bus Pirate without any added components.
Two 2K pull-up resistors (R8, R9) are connected to the I2C lines. The chip is powered at 3.3volts and gets a 0.1uF decoupling capacitor (C6) on the power supply pin.
Buttons
New in Bus Pirate V4 are two buttons. NORMAL starts the Bus Pirate without loading any settings saved in the EEPROM - useful if something when wrong. RESET simply resets the PIC.
PCB
Click for a full size schematic image. Schematic and PCB were designed with the freeware version of Cadsoft Eagle, download the latest project files from our Google Code project page or look for a release package.
Bus Pirate v4 is fairly straight-forward to solder. Start with the PIC, power supply, EEPROM, and 4066, then move to the passives. Finish with the through-hole headers.
If you want to test the PIC before moving further, solder IC1, USB, VR1, C12, L1, C15, R7, and the ICSP header. Now you should be able to power the board over USB and connect to the PIC with a PIC programmer.
Partslist
Click for a full size placement image.
| Part | Quantity | Value | Package |
|---|---|---|---|
| C1-C6, C9, C10 | 8 | 0.1uF | 0603 |
| C7, C8 | 2 | 27pF | 0603 |
| C11-13 | 3 | 1uF | 0603 |
| C14, C15 | 2 | 10uF | SMC_A |
| D1-D2 | 2 | 200mA Schottky diode | SOD123 |
| IC1 | 1 | PIC24FJ256GB106 | TQFP64-10X10 |
| IC2 | 1 | CD4066 | SO14 |
| IC3 | 1 | 24xx64 I2C EEPROM | SOT-23-5 |
| IO | 1 | 2X06 shourded pinheader | PINSHRD_PTH_2X06 |
| L1 | 1 | 700mA+ ferrite bead | 0805 |
| LED1-4 | 4 | LED, 0805 | CHIP-LED0805 |
| NORMAL, RESET | 2 | 5.4mm SMD tact button | TACT_SWITCH_SMALL |
| Q1, Q2 | 2 | PNP, 30hfe+, 800mA+ | SOT23 |
| R1, R2 | 2 | 1K | 0603 |
| R3-6 | 4 | 1K1 | 0603 |
| R7-10 | 4 | 2K | 0603 |
| R11-14 | 4 | 10K | 0603 |
| R15 | 1 | 100K | 0603 |
| RN1-3 | 3 | 10K resistor network, 4R, convex | RN8P-4R-CRA06S |
| USB | 1 | USB mini-b | CONN_USB_MINI-B |
| VR1 VR2 | 2 | MCP1801T-3302I/OT | SOT-23-5 |
| VR3 | 1 | MCP1801T-5002I/OT | SOT-23-5 |
| X1 | 1 | 12MHz Seeed SMD crystal | 4X6 |
The latest sources and distributors are in the master partlist. See something missing? Please let us know.
Firmware
The firmware is written in C and compiled with the free demonstration MPLAB XC16 compiler (which seems to have succeeded Microchip C30 compiler, according to this page). You can download the latest files from our Community Firmware v7.0 project page. See more compiler instructions in the PIC compiler how-to.
Bus Pirate v3 and v4 share the same code base. Improvements to the code will be integrated in the firmware for both versions. There few extra features added for v4, but the main difference is the driver for the on-chip USB hardware in the PIC.
As our flagship open source project, we insisted that the Bus Pirate v4 use open source USB drivers for the firmware and bootloader. The final v4 hardware has been available for more than a year, it was these open source USB components that delayed an official launch.
Thanks to the hard work of Honken and JTR in the forum, there is now an open source USB stack and simple bootloader available for the PIC 24F. The code is open source, so it can be freely distributed with the public domain licensed Bus Pirate source code.
Seeed Studio hardware uses a USB VID and PID provided by Microchip through a limited sublease program. After 10,000 units we need to buy our own for $2,000.
.inf installation
Normal terminal mode and bootloader mode both connect to the computer as a virtual serial port. The virtual serial port (CDC) is an open standard, it should work on any modern operating system and even some tablets.
You don't need a driver, but you will need a .inf file to tell Windows how to use the device. A suitable .inf is included in the project archive.
Bootloader
Bus Pirate v4 can be upgraded over USB. It uses an open source PIC USB bootloader written by JTR, based on the earlier work on Honken in the forum. The bootloader appears as a virtual serial port so it is dead-easy to communicate with and doesn't require a driver. It uses the same protocol as the ds30 Loader serial bootloader, our favorite bootloader that is used on the Bus Pirate v3.
Taking it further
Extra space and more I/O pins on version 4 clear the way for new and improved features. Here's some ideas for the future:
- Integrate all the current accessory firmwares into a single firmware (XSVF player, STK500v2 AVR programmer, extra modes)
- Store BASIC scripts in EEPROM
- Support more LCDs and OLEDs (also graphic LCDs with font support)
- Enable extra pins for JTAG, other modes
- CAN bus support, other new protocols
- Your ideas too!
We'll post the most recent firmware updates on our blog. You can also join the discussion in the forum.
Get one!
Bus Pirate v4 is available now, but v3 is still your best bet.
You can get one for $40, including worldwide shipping.
Your purchases at Seeed Studio keep the open source project coming, we sincerely appreciate your support!











