Source: Wikimedia Commons
Do you need a way to debug, analyze, and prototype unknown or new chips? What you need is a bus pirate. It’s a universal bus interface valuable device for programming, debugging, etc. Plus, It works for various ICs and microcontrollers. Interestingly, if you're an ethical hacker, the bus pirate has all the features you need for prototyping your next project. In truth, there's nothing complicated about using a bus pirate. But, you might encounter some hiccups along the way.
So, in this article, we'll give you a comprehensive guide to using the bus pirate for your Microcontroller or IC projects.
What does a Bus Pirate Do?
Bus Pirate 2
If you're working with unknown microcontrollers, ICs, or planning to run ethical hacking, you'll need a way to debug, analyze, and prototype or program these chips. And a bus pirate can help with that.
Bus pirates can program low-end ICs like Microchip PICs and microcontrollers like the Atmel AVRs. In addition, it can also use advanced protocols like SWD and JTAG for programming. However, it would help if you were careful while using such protocols because of the device's hardware speed limitations.
No doubt, the universal bus device works according to the PIC24 MCU (SSOP) and can use a USB interface to communicate with a host computer. It would help if you also had an on-chip USB module or an FT232RL (SSOP).
Bus Pirate Connections
You can use serial protocols with the bus pirate to establish communication with various chips. These chips are usually between the line levels of 0 to 5.5 volts. The serial protocols supported by the universal bus device include SPI, MIDI, 1-Wire, I2C, and JTAG.
Other features of the bus pirate include:
- The Bus pirate supports Macros for common operations.
- It features 2- and 3- wire libraries that support bitwise pin control.
- The universal bus device also features a SUMP-compatible low-speed logic analyzer that runs between 10 Hz and 1 MHz.
- It features a measurement probe between 0 to 6 volts.
- You can also get bus traffic sniffers like SPI and I2C.
- Its transparent USB supports serial mode.
- It also helps a bootloader for simple firmware updates.
- You can get software reset with 5 volt and onboard 3.3-volt power supplies.
- It features built-in multi-voltage pull-up resistors.
- The device measures frequencies between 1 Hz to 40 MHz.
- It comes with a frequency generator and pulse-width modulator (1 Hz to 4 MHz).
- UART support
- Supports servo drivers
- You can use the universal bus device to program various AVR microcontrollers.
How to Use the UART Bus Pirate
Using the UART mode on a bus pirate is not as simple as using other methods. It requires special handling since you can transfer data at any time. Luckily, you can easily connect your universal bus device to your UART device with these few easy steps:
- First, connect the Bus pirate's transmit pin (TX/MOSI) to the UART device's receive pin (RX).
- Next, connect the receive pin (RX/MOSI) to the UART's transmit pin (TX).
So, here are the pins you need to use modes and macros with flow control.
You can find CTS on the CS pin and RTS on the clock pin.
The PIC passes input from the external circuit via FTDI USB-serial chip for CTS. For RTS, you can mirror the FTDI output with the PIC output.
How to Update Bus Pirate Firmware
Modified Bus Pirate
With the universal bus device, you can access a bootloader that allows you to update your software through a USB connection. It also enables you to write your software update to the PIC 24FJ64GA002’s memory. If there’s no bootloader present, you’d have to use a real programmer like the PICKIT2 via the ICSP header to update your firmware.
Before starting any updates, ensure you get the recent firmware archive and extract it from any folder.
Also, you can find the.HEX firmware and P24QP.exe quick programmer utility files for all versions of universal bus device.
Also, if you’re installing the firmware on a new chip, the bootloader will start automatically. But if you’re not starting with a fresh chip, you’ll need to trigger the bootloader by connecting the ICSP header’s PGC and PGD pins.
If there’s a connection between both pins, the bootloader will start. Otherwise, the universal bus device will boot into the normal firmware.
Now, let’s get into how to update your Bus pirate’s firmware:
- First, make sure your Bus pirate matches your quick programmer COM port. Then, find the COM port number for your universal bus device here and right-click on the quick programmer COM number to select the right port.
Afterward, switch off your universal bus device by disconnecting the power supply, using jumpers to connect the PGC and PGD pins while linking the Bus pirate to your USB port.
- Next, select ‘connect to device’ to open a connection to the bootloader.
- To find the correct firmware for your universal bus device, select ‘open HEX file’ and load your firmware.
- Ensure you remove the previous firmware by selecting ‘erase the device.’ Otherwise, you might experience problems with the new firmware.
- After that, select ‘write device’ to install your new firmware in about 3.5 minutes.
- Select ‘normal execution’ and click yes on the following warning to enter the bootloader again to finish your updates.
- Finally, remove your Bus pirate from your PC, disconnect the jumper wire connections between the PGC and PGD pins, and re-connect your universal bus device.
How to Connect a Pirate Bus
In truth, there are three ports on your Bus pirate for connections. The first port is the ICSP port which allows you to program your PIC microcontroller directly. However, you have a bootloader and reflashing utilities, so you don’t have to use this port.
The second is the mini-B USB jack port. Indeed, this device uses a standard A to mini-B cable to connect to a computer. Also, you can communicate and power up your universal bus device with this port.
Source: Wikimedia Commons
Lastly is the shrouded 0.1” pitch 2x5 pin header. You can use a handy cable to connect your device to the system you plan to develop, reverse engineer, and debug.
Bus Pirate Alternative
Good universal bus device alternatives include:
Bus Blaster vs. Bus Pirates
While Bus pirate is a protocol emulator, a Bus blaster is a JTAG debugger. A Bus blaster only performs JTAG debugging through “openOCD” or urJTAG.
Bus Pirate Driver
When you connect a universal bus device to your PC for the first time, Windows will ask for a driver. Also, you can download the recent drivers from FTDI here and extract them. In addition, you can find it using the “Found New Hardware wizard.”
Bus Pirate V3
The Bus pirate is an excellent way to fulfill your programming, debugging, analyzing, and hacking needs.
However, if you experience certain errors while installing your Bus pirate firmware, you can restart the process without issues. Why? Because the Bus pirate comes with safety measures that prevent overwriting when there’s an installation error.
If you have any questions, feel free to reach out to us, and we’ll be happy to help.