How-to: Bus Pirate bootloader v4 upgrade

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. We’re now cautiously optimistic that the upgrade will go smoothly.

We’d like to invite most Bus Pirate v2go and v3 users to upgrade. If you’re in the middle of a project, don’t upgrade yet, wait and see how it goes. The upgrade has gone smoothly for twenty lots of users, and we tested the latest updater on every version of the Bus Pirate chip and hardware prior to release.

A v1a upgrade will follow if the v2go and v3 deployment goes smoothly. No further support is planned for v0a or v2a hardware. Upgrade instructions follow.

Overview

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.

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. The v2 bootloader is programmed in every Bus Pirate ever sold by Seeed, Fundamental Logic, Sparkfun, and eBay sellers. Use your normal upgrade procedure for the v2 bootloader (Windows, Linux, OSX).

Step 3. Run the updater


Run the upgrader to program the new bootloader to the correct parts of the PIC flash memory.

  1. Remove any jumper between the PGD and PGC pins used for the previous step and plug in the Bus Pirate.
  2. 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.
  3. 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.

  1. 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.
  2. Start the ds30 Loader application, it works on Windows  with .NET, and 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.
  3. Set the correct serial (COM) port for your Bus Pirate. The available ports on your system may be auto-detected.
  4. Select ‘BPv3-Firmware-v4.1.hex’ with the ‘Hex-file’ dialog box.
  5. Press the ‘Download’ button to flash the new firmware to the Bus Pirate. The update should only take a few seconds.
  6. 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 Linux or MaxOSX. Pirate-Loader is a simple command line utility for firmware upgrades on all platforms that doesn’t .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.

Tags: ,

  1. I have successfully upgraded to v4.1 but only after running it with VMWare Fusion under Windows XP. I have tried with Mono, but I had no luck at all. Maybe it’s system specific, but here’s what was wrong:

    1) It does not load settings file. This was fixed once I noticed it tries to load v4firmware\settings.xml where “\” is not a separator in MacOSX. I have renamed the settings.xml to v4firmware\settings.xml and then I got it loaded.
    2) You have to manually enter the port name as it does not list it, it’s okay but when I type the correct for my system: /dev/tty.usbserial-A600aRXE and then hit the “Check for BL” I got the following result:
    > Searching for bl. receive timeout
    > Found unknown device id(-1) fw ver. 9.9.9
    3) Once this happened I decided to give up with Mono/MacOSX. I hope there will be a simple python/perl/php script to upload using console and no fancy GUI. If the protocol is simple as you mentioned somewhere maybe I should give it a go and create one myself.

    I also have a question about the ds30 loader itself: Once you click “Check for bs” you will have to reconnect the BP as it won’t be discovered again. Is it supposed to be this way?

    Reply

  2. Yes, the ds30 Loader only gives you one chance to connect to the bootloader. If you click check for BL then you have to reset the bus pirate before you can program or check for the bootloader again.

    If you’d like a dump and explanation of the protocol, let’s start a topic in the forum. It would be great to have a python script to update the firmware.

    Reply

    1. pppd put together a console updater for Linux and Max OSX:
      http://whereisian.com/forum/index.php?topic=250.msg1896#msg1896

      Reply

  3. Followed the instructions and successfully updated without any issues!

    17:52:18.750> * Syntax error, type ? for help
    17:52:21.875> HiZ>i
    17:52:21.875> Bus Pirate v3
    17:52:21.875> Firmware v4.1 Bootloader v4.1
    17:52:21.875> DEVID:0×0447 REVID:0×3003 (A3)
    17:52:21.875> http://dangerousprototypes.com
    HiZ>

    Reply

    1. Firmware v4.1 nad Bootloader v4.1 update worked flawlessly on my v3a Bus Pirate. Thanks!

      Reply

  4. All done, no problems encountered :-)

    Reply

  5. Worked fine for me without any problems, thanks!

    v3.6 -> v4.1

    Reply

  6. Another one successful. Only difference I noted was when I loaded the HEX file in the DS30 app that it showed 21503 words not 21504 as the image above shows

    HiZ>i
    Bus Pirate v3
    Firmware v4.1 Bootloader v4.1
    DEVID:0×0447 REVID:0×3003 (A3)
    http://dangerousprototypes.com

    Reply

    1. That shouldn’t be a problem. I used screenshots from an older version, that’s probably the discrepancy.

      Reply

  7. Another successful update, though like the first poster I just had so many probs trying to get the ds30 loader/mono working in OSX I said screw it, and went to try it in Parallels Desktop… but suddenly Parallels was unhappy with my VM’s image so let it sit until I got home and wrassled the FTDI driver + Win7 into working (only had to manually install the driver 3 times + 3 reboots before it worked!)

    Reply

  8. (MSVista32/P24QP@9600/DS30loader@115200)
    BPv3 successful upgrade to v4.1:

    * Syntax error, type ? for help
    HiZ>i
    Bus Pirate v3
    Firmware v4.1 Bootloader v4.1
    DEVID:0×0447 REVID:0×3043 (B5)
    http://dangerousprototypes.com
    HiZ>

    Reply

  9. Upgrade done succesfull.
    I have only one problem. When i try change firmware to STK500 AVR Programmer (file v3-STK500v2-v0a-hiz.hex), DS30 Loader says “The hex-file contains code that will overwrite the bootloader
    “. Do you prepare upgrade for STK500 AVR Programmer firmware?
    Thanks

    Reply

      1. All working fine. Thank you.

  10. Just a quick note on Step 3.

    Make sure that when you connect to the Bus Pirate after upgrading the bootloader you set your serial speed to 115200 bps. I initially connected at 9600 bps witch resulted in garbage in the terminal, after hitting enter, and made me freak out for a second.

    Reply

  11. Another successful upgrade (SPE BPv3).

    One quick question (probably not the right place but oh well!): with regards to the buspirate and avrdude. Ive built avrdude 5.9 for windows, and the BPv3 programs my atmega chip fine. But its rather slow, as in 205s for 6370bytes program!

    Im sure its probably something simple. Im using the extended switches for avrdude “-x speed=7″ but for some reason changing this number doesnt make this faster! Has any one encountered this? Also, it takes a while for it to go from the “Detecting BusPirate…” to “avrdude: AVR device initialized and ready to accept instructions” – is there a long timeout in the BP part of avrdude or is this a limitation of the BP?

    Meanwhile ill give the stk500v2 emulation a go, but would prefer the above route (so i can have a bus pirate and a programmer handy!)

    Reply

  12. Bus Pirate v3
    Firmware v4.1 Bootloader v4.1
    DEVID:0×0447 REVID:0×3003 (A3)
    http://dangerousprototypes.com

    Worked fine under Virtualbox Non-OSS on Linux

    Reply

  13. Hi
    installed successfully on two BP @v3
    Question I installed the default bootloader, should I upgrade to the 4.2 BL. if so how?

    great work
    SM

    Reply

    1. thanks! v4.2 is just a separate version number for the bootloader that’s included in the firmware archive instead of the upgrade utility. This way we can provide better support. There’s no technical difference, one is an upgrade, the other is programmed with a PIC programmer.

      Reply

  14. Successful upload of boot-loader v4 into my v2go

    however, when I launch ‘ds30 Loader Gui.exe’, I get the following error message: The application failed to initialize properly (0xc0000135). Click on OK to terminate the application.’

    I’m on Windows XP SP3. Any Ideas?

    Reply

    1. You’ll need the .net framework for the GUI, or you can use the Linux/Mac/Windows console program instead:
      http://dangerousprototypes.com/2010/01/19/bus-pirate-bootloader-v4-console-for-linux-mac/

      Reply

      1. Thanks, I overlooked the .net dependency. Everything OK now!

  15. no problems upgrading the v2.go on Windows Vista:

    HiZ>i
    Bus Pirate v3
    Firmware v4.1 Bootloader v4.1
    DEVID:0×0447 REVID:0×3043 (B5)
    http://dangerousprototypes.com

    Reply

  16. Hi,

    Upgraded my bus pirate v3 to bootload/firmware v4 successfully !

    Keep up great job !

    Reply

  17. The boot loader update is returning a ton of errors in the errors.txt file. Trying to update a BPv3a. Working with Win XP. Tried 115000 and 9600 and there was no difference in the number of errors. As I recall the errors start at byte 4 and continue all the way. Sorry to be so vague but I am not near my hardware. I pulled the jumper and tried to connect with a terminal, just on the odd chance, but I could not make a connection. The firmware is currently 2.4 as recall.

    Thanks for any help

    Reply

    1. Errors between 0×400 and 0xc00 are normal, that’s where the bootloader lives and it doesn’t get overwritten.

      Can you give me the name of the file that you tried to load? Did you press the erase button first?

      Reply

      1. I am not at work so I can’t tell you the exact name, but it is the file that came in the download, “blupdater” in the name. No I did not erase first.

    2. That’s probably it. You need to erase the erase the chip before you program it. It’s step 4 in the upgrade procedure:
      http://dangerousprototypes.com/2009/07/24/bus-pirate-firmware-upgrades/

      Press the erase button before pressing the program button. Please give that a try and let me know if it helps.

      Reply

      1. Thanks, I sure will give that a try and let you know. I never saw that firmware upgrade page, that will help alot!

        Thanks again.

      2. Worked!
        Why are there different REVID numbers; some A3 and some B5?

        Thanks again!

        HiZ>i
        Bus Pirate v3
        Firmware v4.1 Bootloader v4.1
        DEVID:0×0447 REVID:0×3003 (A3)
        http://dangerousprototypes.com
        HiZ>

      3. Microchip makes small changes to the silicon between batches. The Bus Pirate only uses features that work on all chip revisions.

  18. Upgraded BPv3a from BLv2/v3.6 to BLv4.1/v4.1 successfully (1st try) on WinXP Pro with .NET according to instructions.

    Thank you for a great device and your development/support efforts!

    Reply

  19. Upgraded my bus pirate v3 to bootloader and firmware v4 successfully !

    Bus Pirate v3
    Firmware v4.1 Bootloader v4.1
    DEVID:0×0447 REVID:0×3043 (B5)
    http://dangerousprototypes.com

    Well done soldiers!

    Reply

  20. Upgraded BusPirate v2go from 3.6 to 4.1 succesfully!

    Bus Pirate v3
    Firmware v4.1 Bootloader v4.1
    DEVID:0×0447 REVID:0×3043 (B5)
    http://dangerousprototypes.com

    Reply

  21. Upgraded a V2go purchased from Seed (initially came with bootloader only) to 4.1 following these instructions with no problems.

    Using it to test a GPS receiver module now in UART mode, reading NMEA-0183 sentences right now.

    Thanks!

    Reply

  22. Just upgraded my V3a that showed up from seeed.

    Went smooth and was easy. Nice job.

    chris

    Reply

  23. It went well except for the Mode led. It never came on or blinked during the entire process contrary to the instructions here on the web.

    After I convinced myself that the normal firmware wasn’t running I assumed the V2 bootloader was running and went ahead with the procedure and everything turned out fine.

    Reply

    1. Hi Don,

      I’m sorry about the LED. You might try touching a soldering iron to the edges of the MODE LED. There was a problem with dirty contacts in a reel of LEDs, and they didn’t reflow correctly. Most have been fixed with a quick resoldering.

      Reply

  24. Hi. My Bus Pirate just arrived today and upgraded successfully :D
    Only to rename it I had to use the official ftdi utility (M_Prog) on windows since PirateRename not worked for me on Leopard PPC (I recompiled it since the precompiled version available on google code is intel only), not a big problem anyway

    Reply

  25. Hi

    After realising I had to erase the pic before programming the upgrade bootloader, the rest went smoothly. Till now i never had to erase the pic to get a working firmware.Thank you for the detailed instructions.

    Cheers
    Rubi

    Reply

  26. One ds30loader bug I found, after check for bl I had to unplug and then plug the buspirate in again, else download is impossible.

    Cheers
    Rubi

    Reply

    1. That’s a limitation of how I setup the bootloader. It is fixed in the next bootloader release though.

      Reply

  27. Had small issues, didnt read the documentation properly. After erasing the chip and reading (yes reading) the instructions, updated both the bootload and firmware the the latest versions

    Reply

  28. hello all…upgrade went smooth…so did self test!

    i
    Bus Pirate v3
    Firmware v4.1 Bootloader v4.1
    DEVID:0×0447 REVID:0×3043 (B5)
    http://dangerousprototypes.com
    HiZ>~
    Disconnect any devices
    Connect (Vpu to +5V) and (ADC to +3.3V)
    Press a key to start
    Ctrl
    AUX OK
    MODE LED OK
    PULLUP H OK
    PULLUP L OK
    VREG OK
    ADC and supply
    5V(5.02) OK
    VPU(4.99) OK
    3.3V(3.33) OK
    ADC(3.26) OK
    Bus high
    MOSI OK
    CLK OK
    MISO OK
    CS OK
    Bus Hi-Z 0
    MOSI OK
    CLK OK
    MISO OK
    CS OK
    Bus Hi-Z 1
    MOSI OK
    CLK OK
    MISO OK
    CS OK
    MODE and VREG LEDs should be on! Any key exits.

    Reply

  29. Upgrade went perfectly! I have a BPv3, with 3.1 firmware. I first upgraded to firmware v3.6, and after that succeeded I then followed this tutorial and got this:

    i
    Bus Pirate v3
    Firmware v4.1 Bootloader v4.1
    DEVID:0×0447 REVID:0×3003 (A3)
    http://dangerousprototypes.com
    HiZ>~
    Disconnect any devices
    Connect (Vpu to +5V) and (ADC to +3.3V)
    Press a key to start
    Ctrl
    AUX OK
    MODE LED OK
    PULLUP H OK
    PULLUP L OK
    VREG OK
    ADC and supply
    5V(4.92) OK
    VPU(4.93) OK
    3.3V(3.28) OK
    ADC(3.28) OK
    Bus high
    MOSI OK
    CLK OK
    MISO OK
    CS OK
    Bus Hi-Z 0
    MOSI OK
    CLK OK
    MISO OK
    CS OK
    Bus Hi-Z 1
    MOSI OK
    CLK OK
    MISO OK
    CS OK
    MODE and VREG LEDs should be on! Any key exits.
    HiZ>

    Reply

  30. Hi, what’s the status of v1a support? Would be nice to have it ;-)

    (indeed, it’s not worth it if I’m the only user of v1a hardware…)

    Reply

    1. There is no upgrader, but you can program the v4 bootloader for v1a from the latest firmware release with a PIC programmer.

      You can also load the v4v bootloader for v1a without a programmer. Just load the bootloader file using the p24qp.py utility, then upload the v4 firmware with the ds30 Loader or Pirate-Loader console application as described here.

      You can also or the p24qp.exe utility to upload the v4 bootloader if you uncheck the ‘protect config fuses’ box before you erase. Be sure you don’t loose power during this operation or you loose the config fuses and the Bus Pirate will be ‘bricked’.

      Reply

  31. failed for me.
    Initiating download…
    Searching for bl . . . . . . . . . . . . . . . . . . . . timed out
    Tx 20 bytes / Rx 0 bytes / 5.2s

    Reply

    1. Hi chipres, sorry about the upgrade issue.

      What Bus Pirate are you using, and when did it ship? Did step 3 complete successfully? Can you still open a terminal to the upgrader utility? Are you using a jumper over the programming pins, and does the MODE LED light in step 4?

      Reply

  32. OK finally working
    HiZ>i
    Bus Pirate v3
    Firmware v4.1 Bootloader v4.1
    DEVID:0×0447 REVID:0×3043 (B5)
    http://dangerousprototypes.com

    Reply