Bus Pirate

Bus Pirate
Bus Pirate

As I wrote yesterday I bougth the Bus Pirate from Seeedstudio and a nice case. Another team member found this nice tool. It can be used to prototype and test electronic deviecs with buses such as UART, SPI or I2C. As I saw the ability to work as an AVR programmer and even a JTAG adapter I was persuaded of it as well. It looks like a perfect devleoper device for the NG UAVP.
With delivery I paid about 55$ for both parts. The case from US arrived way faster then the Pirate itself from China, but finally both made their way to Switzerland! I needed to alter the case with a nail file a little bit to make sure the USB connector has enought space. Built into its case it looks very nice!
The firmware on the delivered device was not that up to date:

Bus Pirate v3 (Seeed Studio)
Firmware v2.4-Seeed
DEVID:0x0447 REVID:0x3043 (B5)

First I had to upgrade to V4 Bootloader. I connected the PGD and PGC pins of the ICSP header to trigger the bootloader. Then I changed bitrateindex to 8 (for 115200):

vi P24qp.ini

Afterwards I could do the firmwareupgrade (just ignore the verification errors in the output, its a bug in v2 bootloader):

$ unzip v2tov41-bootloader-update-va3.zip
$ cd upgrader
$ sudo python P24qp.py --serial=/dev/ttyUSB1 -v --auto=BPv3-v2blupdaterVa3-v4.1.hex
Writing 256 bytes to address 0x0000AB80
Reading 256 bytes from address 0x0000AB80
Write operation complete.
Verified Okay.
Verification complete, switching to user mode

Now I removed the jumper and restartet the Bus Pirate. Pressing enter produced this output:

Upgrade cancelled.

Universal DS30 Loader installer v0.3 (C)hris 2010

Released under Creative Commons null license.
Found bootloader v unknown (probably v2)
Will install bootloader v4.1

Type 'Yes' to program the new bootloader.
Disconnect power if unsure (no harm done).

“Yes” started the upgrading

Erasing 0xA400... done
Erasing 0xA800... done
Writing row 0 1 2 3 4 5 6 7 done
Erasing 0x0000... done
Writing row 0... done

Upload new firmware with the ds30 Loader app to complete the upgrade.

When the update is complete, the MODE LED will blink and the upgrader will prompt you to upload a v4+ firmware. I connected the PGD and PGC pins of the ICSP header to trigger the bootloader once again and restarted the Bus Pirate. I then uploaded the v4.2 firmware directly (you can’t install the v4.2 bootloader since its only a version for programm with PIC directly):

$ unzip BusPirate.firmware.v4.2.zip
$ sudo ./pirate-loader_lnx --dev=/dev/ttyUSB1 --hex=BPv3\&v2go/BPv3-Firmware-v4.2.hex

Removed the jumper again and the Bus Pirate has a shiny new software version on it:

Bus Pirate v3
Firmware v4.2 Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)

AVR programmer (STK500v2)

One of the features I needed most was the AVR programmer. For that purpose you have to flash a special firmware:

$ sudo ./pirate-loader_lnx --dev=/dev/ttyUSB1 --hex=BPv3\&v2go/BPv3-STK500v2-v0b.hex

Afterwards you can use it like an STK500v2:

$ avrdude -p m328p -c stk500v2 -P /dev/ttyUSB1 -v -V -U flash:w:sb-ctrl.hex

Just a small performance comparission showed positive results. I wrote an Intel hex with 30178 bytes to an Atmel ATMEGA328P. These are the flash times:

Bus Pirate STK500v2
10.75s 42.55s

Note: These are both out of the box configuration, with correct STK500v2 configuration you can probably gain more performance…