V2 to v4 upgrades
The bootloader is a small program in the Bus Pirate that installs a firmware upgrade. The bootloader itself can also be upgraded with a small amount of effort.
Firmware version 4 and higher requires bootloader version 4 or higher. The new v4 bootloader makes space for more features.
Use command i in the terminal to display the current version (type i then press the enter key)
- Hardware v3b and v3.5 shipped with a v4+ bootloader, don't do anything!
- Hardware v3a and v2go shipped with the v2 bootloader, please see upgrade instructions below
- Verify version with command i in the terminal (type i then press enter)
Bus Pirate firmware v4+ requires a bootloader upgrade. The upgrade frees space for more features, eliminates verify errors in the last page of memory, and fixes the bootloader speed limitation on some PICs. The new bootloader is available to everyone through an upgrader firmware that is loaded using the existing bootloader.
Thanks to the developers and testers who contributed to the bootloader update. You caught two major bugs prior to wider user trials. Further upgrades have gone smoothly.
A v4 bootloader for Bus Pirate v1a is included in firmware downloads, but you'll need to program it with a PIC programmer, no upgrade utility has been made. No further support is planned for Bus Pirate v0a or v2a hardware. Upgrade instructions follow.
What we're going to do is use the existing v2 bootloader and P24QP.exe application (or Python script) to upload a bootloader upgrader. The upgrader will erase and reprogram the correct parts of the PIC flash memory with the new bootloader. After the new bootloader is programmed, we'll erase the installer and old bootloader by uploading a v4 Bus Pirate firmware.
***STOP*** DO NOT UPLOAD A V4 FIRMWARE TO A V2 BOOTLOADER WITH P24QP.PY!!!
The Windows P24qp.exe utility does not have this issue - it preserves the config words on erase - so accidental v4 uploads don't damage the configuration words.
The Python utility erases the entire chip, including the 'configuration words' that determine how the pic behaves on start-up. The v4 firmware does not contain replacement configuration words, so the Bus Pirate won't start from the correct clock after programming a v4 firmware to a v2 bootloader with p24qp.py. Only Upload v2 firmware or BPv3-v2blupdaterVa3-v4.1.hex with P24QP.PY.
Despite this warning, some will still be tempted - don't do it, it's the only significant source of upgrade failures. Read all the steps here first, before you upgrade. Heed the warnings in the firmware archives - please don't try to upload v4 firmware to a Bus Pirate with a v2 bootloader.
Have a PIC programmer? Just program the bootloader HEX included in the latest firmware download. Program the whole memory range, including the config bits. Get the latest firmware from the Google Code repository.
Step 1. Download the upgrade package for v2go & v3
The upgrade package (v4.1-va3) includes:
- Bootloader updater (BPv3-v2blupdaterVa3-v4.1.hex)
- V4 Bus Pirate firmware compatible with the new bootloader (BPv3-firmware-v4.1.hex)
- Application for v2 bootloader (P24QP.exe or P24qp.py)
- Application for v4 bootloader (ds30Loader.exe)
Note that Bus Pirate v2go and v3 now use the same bootloader and firmware. Do not use this upgrade with v2a, v1a, or va.
Step 2. Load the bootloader upgrader
Upload ' BPv3-v2blupdaterva3-v4.1.hex' to the PIC with the existing v2 bootloader. Use your normal upgrade procedure for the v2 bootloader to load the upgrade HEX into the PIC. V2 bootloader instructions for: Windows, GNU/Linux, OSX.
The v2 bootloader is programmed in:
- v3a from Seeed Studio and Adafruit Industries
- All v2go
- Every Bus Pirate sold by Fundamental Logic and SparkFun
v3b from Seeed and Adafruit comes with a v4 bootloader installed.
Step 3. Run the updater
Run the upgrader to program the new bootloader to the correct parts of the PIC flash memory.
- Remove any jumper between the PGD and PGC pins used for the previous step and plug in the Bus Pirate.
- Open a terminal and press <enter> to see the updater greeting. Type 'yes' to start the upgrade, any other key cancels and repeats the updater greeting.
- The update will only take a fraction of a second, but be sure the Bus Pirate doesn't lose power or it could be bricked.
The upgrader will erase and write a few memory locations. When the update is complete, the MODE LED will blink and the upgrader will prompt you to upload a v4+ firmware with ds30 Loader.
Step 4. Upload v4+ firmware with ds30 Loader
To complete the upgrade, install a v4+ firmware with the ds30 Loader application or the Pirate-Loader command line utility. Only firmware v4+ is compiled to work with the v4 bootloader.
- Unplug the Bus Pirate (if connected), place a jumper between the PGC and PGD pins, and plug it in. The MODE LED should be on.
- Start the ds30 Loader application, it works on Windows with .NET, and GNU/Linux and Mac with Mono (or you can try the Pirate-Loader command line utility). It will start preconfigured for the Bus Pirate based on the default settings in settings.xml.
- Set the correct serial (COM) port for your Bus Pirate. The available ports on your system may be auto-detected.
- Select 'bp4.0-fw-7.0.hex' with the 'Hex-file' dialog box.
- Press the 'Download' button to flash the new firmware to the Bus Pirate. The update should only take a few seconds.
- When the update is complete, remove the programming jumper and reset the Bus Pirate (unplug and plug it in again).
The upgrade is complete. For future firmware upgrades, repeat this section.
Pirate-Loader console utility: The ds30 Loader GUI requires .NET or Mono, and doesn't work for everyone on GNU/Linux or MaxOSX. Pirate-Loader is a simple command line utility for firmware upgrades on all platforms that doesn't need .NET or Mono.
V2go note: after the upgrade to bootloader v4, placing the upgrade jumper between PGC and GND will also activate the bootloader.
Step 5. Verify the upgrade
Connect with a terminal and print the information menu (i). Firmware v4+ reports the bootloader version. Bootloaders installed with the upgrade utility will report v4.1. Bootloaders installed from the v4.1 firmware download (using a PIC programmer) will report v4.2. There's no functional difference, it's just a way to better handle support requests.
Please let us know if you attempted the upgrade and how it went. It's really important to know if the upgrade is successful before we expand it to all users.
Mac OS X
First you need to install the pySerial Package:
Then you get the upgrade package , unpack it and switch to:
To upgrade the bootloader you have first deconnect the buspirate, bridge the two pins PGC and PGD, and re-connect the buspirate again. Then you're ready to load the upgrader (find the id of your buspirate by tabbing after usbserial):
python P24qp.py -s /dev/tty.usbserial-<your-ftdi-id> -a BPv3-v2blupdaterVa3-v4.1.hex -v
The following output should be produced:
Using Serial Port /dev/tty.usbserial-A700eE4k @ 9600 Reading 4 bytes from address 0x00FF0000 Found PIC24FJ64GA002 Erase Flash: Erasing 43 pages, starting at 0x00000000 Erase complete Writing 256 bytes to address 0x00000000 Reading 256 bytes from address 0x00000000 Verification failed at 0x00000000: 0 != 4 Verification failed at 0x00000001: 4 != 12 Writing 256 bytes to address 0x00000080 Reading 256 bytes from address 0x00000080 8<-------8<-------8< Reading 256 bytes from address 0x0000AB00 Writing 256 bytes to address 0x0000AB80 Reading 256 bytes from address 0x0000AB80 Write operation complete. Verified Okay. Verification complete, switching to user mode
Afterwards, disconnect the bus pirate, remove the bridge the two pins PGC and PGD, then connect to your buspirate at 115200 baud. You can use the command:
sudo cu -s 115200 -l /dev/tty.usbserial-<your-ftdi-id>
You'll be greeted with:
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).
I propose to try it with yes.
Erasing 0xA400... done Erasing 0xA800... done Writing row 0 1 2 3 4 5 6 7 done Erasing 0x0000... done Writing row 0... done Success! Upload new firmware with the ds30 Loader app to complete the upgrade.
Now you're ready for the latest Community Firmware v7.0
Now disconnect the Bus Pirate. Change into the folder which contains bp4.0-fw-7.0.hex file.
After you connected the Bus Pirate again with the two pins connected (PGC and PGD) as described above we run the pirate-loader with something like this:
./pirate-loader_mac --dev=/dev/tty.usbserial-<your-ftdi-id> --hex=bp4.0-fw-7.0.hex
You should get something like this:
Writing page 41 row 333, a680...OK Writing page 41 row 334, a700...OK Writing page 41 row 335, a780...OK Firmware updated successfully :)! Use screen /dev/tty.usbserial-<> 115200 to verify
Re-connect your Bus Pirate once more and you're ready to go.
based on the blog of Ninja Bong
Upgrade problems have been reported with minicom on Ubuntu