STOP!!! You probably need the v2 to v4 upgrade guide instead!!!
See the latest version in the documentation wiki.
Bus Pirate firmware updates can be done from Linux or OSX using the Python PIC24F programmer developed by broeggle and JoseJX. The programmer works on all operating systems that support Python and pySerial: Linux, OSX, and Windows, too. Thanks for a great script!
Our step-by-step guide to the Python PIC24F programmer continues after the break.
Here’s some key stuff to get:
Install Python 2.x and the pySerial module. Download the firmware and programmer, move the required files into a convenient directory.
Disconnect the Bus Pirate from the USB cable (and power supply if applicable). Place a jumper between the PGC and PGD pins (A), as described in the Windows quick programmer tutorial. Plug the Bus Pirate back in.
Bus Pirate Programmer v1.0
-a –auto=FILE – Erase, Program and Quit the Bootloader
-c –config=FILE – P24qp compatible configuration file
-e –erase – Erase the flash programming
-f –finalize – Finalize the programming and go to user mode
-i –info – Information about the bootloader
-q –quiet – Quiet messages about writing progress
-r –read=FILE – Read programming from flash
-s –serial=DEVICE – Override serial device path
-t –reset – Reset the bootloader
-v – Enable verification of write commands
-w –write=FILE – Write programming file to flash
Run the programmer from the command prompt for a short description of the flags and options.
JoseJX recommends auto mode with verify, using the command:
P24qp.py -a <hexfile> -s <serial port> -v
Substitute <hexfile> with the name of the firmware .HEX file, something like v25-Firmware-v2.hex for the Bus Pirate v2go. Replace <serial port> with the device name you system assigned to the Bus Pirate’s FTDI USB->serial converter chip.
The serial port name can be tricky, hopefully these examples help. Replace ‘x’ with the number for your system. Look in the system dmesg to find the Bus Pirate on Linux, or in the control panel on Windows.
C:\Python26>python P24qp.py -a v25-Firmware-v2.hex -s COM5 -v
Using Serial Port COM5 @ 115200
Reading 4 bytes from address 0x00FF0000
Erasing 43 pages, starting at 0x00000000
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
Writing 256 bytes to address 0x00000100
…<<< This continues for awhile
Reading 256 bytes from address 0x0000AA80
Writing 256 bytes to address 0x0000AB00
Reading 256 bytes from address 0x0000AB00
Writing 256 bytes to address 0x0000AB80
Reading 256 bytes from address 0x0000AB80
Verification complete, switching to user mode
Ignore any verify errors at the beginning (0x0, 0x1) and between 0x400 and 0xbff, these are bootloader protected locations. A really nice thing about the Python programmer is that it knows to ignore errors in the protected bootloader section.