when I typed "it was using" I meant to say "I was using'.
So I was using the sandbox electronics bus pirate, and getting that error so I just connected to it and used the command (I forget which) to dump the cable colors and wires, then followed those, ignoring the particular instructions i had in front of me which showed a picture of the dangerous prototypes bus pirate and its included ribbon cable colors and how they hooked up to the device in question. The end result was very different to someone using the authentic bus pirate and I can't remember the details but it wasn't the case of a swapped color or anything, nearly everything, or entirely everything was different.
I had this problem and it was because of wrong wiring.
Specifically, it was using the sandboxelectronics bus pirate with its included ribbon cable and assuming the colors matched. They don't. You need to look at the pin out for the sandboxelectronics bus pirate (also available from serial connection to it and issue a command, I forget which, to show the pin outs and colors)..
If Initialization failed rc=-2 it means the target chip could not be put into programming mode, which usually means the wiring is not correct.
Never mind, I solved it. My Mac PL2303 USB driver had become wedged.
After I was told by sandbox electronics you can't brick the 2303, even if you can brick the bus pirate, so a device should always be created, I tried harder and got to the boot loader again.
I still could not use pirate_loader as delivered though.
in the end I found that the code to open and configure the serial port does not work correctly under OSX 10.6
I revised it as below, using hints a stackoverflow question (# 6947413) on how to read/write to FTDI serial port. and it works now:
would fail repeatedly: +++++++++++++++++++++++++++++++++++++++++++ Pirate-Loader for BP with Bootloader v4+ Loader version: 1.0.1 OS: Darwin +++++++++++++++++++++++++++++++++++++++++++
Parsing HEX file [BPv3&v2go/BPv3-STK500v2-v0c.hex] Found 21502 words (64506 bytes) Fixing bootloader/userprogram jumps Opening serial device /dev/tty.PL2303-00001004...OK Configuring serial port settings...OK Sending Hello to the Bootloader...ERROR No reply from the bootloader, or invalid reply received: 4 Please make sure that PGND and PGC are connected, replug the devide and try again
Note that it receives 4 characters. Could it be receiving BP4+? But not the magic "K"? When I wrote the HELLO character to the bootloader via just printing it into the serial port, it did reply K in the console.
After restart arduino serial console a few times, and then re-running the firmware update program several times, it succeeded, sort of:
Parsing HEX file [BPv3-STK500v2-v0c.hex] Found 21502 words (64506 bytes) Fixing bootloader/userprogram jumps Opening serial device /dev/tty.PL2303-00001004...OK Configuring serial port settings...OK Sending Hello to the Bootloader...OK
At this point when I plug it into USB, yellow LED on, or off. no device gets created anymore :(
What did I do wrong?
Why couldn't the update program see the bootloader response, and why after writing one page then failing, is it no longer talking over USB at least to the bootloader?
Sad face. I feel like I'm in a shave the yak scenario.. like I got the bus pirate to fix something, which should fix something, which should (I forget the chain it goes up so high) ... and now i need a bus pirate to fix my bus pirate?