Flashing the Bus Pirate 3

2024/10/04

Tags: tags

Updating the Bus Pirate 3.6a to the latest available community firmware

The community firmware is available here: https://github.com/BusPirate/Bus_Pirate/tree/master HOWEVER there are no prebuilt versions for the Bus Pirate 3, or matching up to the latest commits. Built versions are available in this thread.

What is the latest bootloader version for the Bus Pirate 3.6a?

Latest prebuilt version is in this post from Sept 20th 2020

Do you need to update the bootloader as well as the firmware?

From this message Latest firmwares require the new bootloader v4.5 in order to be fully functioning. Without upgrading the bootloader to v4.5 it will not be possible to jump into bootloader from terminal using command $, so that instead it will be necessary to use jumper on PGD and PGC.

How to upgrade

Download the last available update from http://dangerousprototypes.com/forum/index.php?action=dlattach;topic=8498.0;attach=15705 in the forum post http://dangerousprototypes.com/forum/index.php?topic=8498.msg71171#msg71171 It will have the filename BPv3-bootloaderv4xtov45-update_fw-TEST Gabriel Smith JTAG Fix_ENG-v0.7z

  1. Enter the bootloader: Connect PGC and PGD pins of the ICSP header or type $ in the Bus Pirate terminal. (You will need to use the jumper after programming the bootloader as after that you don’t get a console, so we may as well use the jumper method from the start) The MODE LED should light.

  2. Make the loader executable chmod +x ./pirate-loader_lnx

  3. Update the bootloader

./pirate-loader_lnx --dev=/dev/ttyUSB0 --hex=BPv3-bootloader-upgrade-v4xtov4.5.hex
+++++++++++++++++++++++++++++++++++++++++++
  Pirate-Loader for BP with Bootloader v4+  
  Loader version: 1.0.2  OS: Linux
+++++++++++++++++++++++++++++++++++++++++++

Parsing HEX file [BPv3-bootloader-upgrade-v4xtov4.5.hex]
Found 1874 words (5622 bytes)
Fixing bootloader/userprogram jumps
Opening serial device /dev/ttyUSB0...OK
Configuring serial port settings...OK
Sending Hello to the Bootloader...OK

Device ID: PIC24FJ64GA002 [d4]
Bootloader version: 1,02
Erasing page 0, 0000...OK
Writing page 0 row 0, 0000...OK
Writing page 0 row 1, 0080...OK
....
Writing page 41 row 331, a580...OK
Writing page 41 row 332, a600...OK
Writing page 41 row 333, a680...OK
Writing page 41 row 334, a700...OK
Writing page 41 row 335, a780...OK
Erasing page 42, a800...ERROR [50]

Error updating firmware :(

The error is to be expected (pirate loader bug?) - see this github issue

  1. re-plug the USB cable to reset the Bus Pirate.
Universal DS30 Loader installer v0.4 (C)hris 2010

Released under Creative Commons null license.
Found bootloader v4.4
Will install bootloader v4.5

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

Type yes, and once the bootloader update is complete, unplug and replug the Bus Pirate

Connect PGC and PGD pins of the ICSP header to enter the bootloader and plug in the USB cable

We update to the unsafe version (this is not really unsafe - it uses hardware i2c that some early versions of the PIC did not have - the chances of having one of these boards is nil, and in any case it would not be destructive, i2c would simply not work)

./pirate-loader_lnx --dev=/dev/ttyUSB0 --hex=busPirate_JTAG_UNSAFE_1.hex
+++++++++++++++++++++++++++++++++++++++++++
  Pirate-Loader for BP with Bootloader v4+  
  Loader version: 1.0.2  OS: Linux
+++++++++++++++++++++++++++++++++++++++++++

Parsing HEX file [busPirate_JTAG_UNSAFE_1.hex]
Found 17483 words (52449 bytes)
Fixing bootloader/userprogram jumps
Opening serial device /dev/ttyUSB0...OK
Configuring serial port settings...OK
Sending Hello to the Bootloader...OK

Device ID: PIC24FJ64GA002 [d4]
Bootloader version: 1,02
Erasing page 0, 0000...OK
Writing page 0 row 0, 0000...OK
Writing page 0 row 1, 0080...OK
Writing page 0 row 2, 0100...OK
Writing page 0 row 3, 0180...OK

...
Writing page 41 row 333, a680...OK
Writing page 41 row 334, a700...OK
Writing page 41 row 335, a780...OK
Erasing page 42, a800...ERROR [50]

Error updating firmware :(

Again the error is to be expected.

Remove the jumper from PGD to PGC and reconnect.

The info option should display the updated version

HiZ>i
Bus Pirate v3.5
Community Firmware v7.1 - goo.gl/gCzQnW [HiZ 1-WIRE UART I2C SPI 2WIRE 3WIRE KEYB LCD PIC DIO] Bootloader v4.5
DEVID:0x0447 REVID:0x3046 (24FJ64GA00 2 B8)
http://dangerousprototypes.com

Other notes

The Bus Pirate 3.6a is the Sparkfun version of the Bus Pirate 3.6 which is functionally identical to the Bus Pirate 3.5

A device purchased from Pimoroni in 2024 (probably old stock - I’m guessing they aren’t selling many these days!) shipped with the following firmware versions

HiZ>i
Bus Pirate v3b
Firmware v5.10 (r559)  Bootloader v4.4
DEVID:0x0447 REVID:0x3046 (24FJ64GA002 B8)
http://dangerousprototypes.com

Note avrdude support is broken in comminity firmware 7.1 - 7.0 is OK apparently See https://github.com/BusPirate/Bus_Pirate/issues/122#issuecomment-470428292 and https://github.com/avrdudes/avrdude/issues/1616