When reading the flash programming specification of the PIC32 micros, an idea crossed my mind.
Some background:
The MIPS core that Michrochip choose for the PIC32 already had a JTAG interface implementation (EJTAG), and the pins are available on the outside.
Instead of implementing a separate programmer/debugger for 2-wire ICSP, they added a 2-wire to 4-wire converter in front of the JTAG. The ICSP programmer has to talk to the chip over 2 wires in a special protocol that uses a special synchronous time multiplex to transfer the state of the 4 JTAG signals over 2 wires.
The internal 2-wire to 4-wire converter converts this back to 4 signals and sends it to the JTAG interface.
So, my idea was to implement this 4-wire to 2-wire converter in the CPLD of the Bus Blaster.
This way, one could use the Bus Blaster to flash and debug PIC32 micros with OpenOCD via 2-wire ICSP, the same way as you would do it with JTAG, without having to care about the different transport layer.
as I'm currently trying to get OpenOCD running with PIC32, I'd be interested to stay in touch with you. Is there any forum, blog, mailing list, or whatever we could use for this project?
OpenOCD is interesting in this case, because the PGD/PCD interface of the PIC32 is in fact a JTAG interface. The MIPS core of the PIC32 already had a JTAG implementation. Instead of adding a separate 2-wire programming interface, Microchip added a 2-wire to 4-wire extension logic to the chip. So, to programm or debug a PIC32, you have to use the usual JTAG functions, reduce the signals from 4-wire to 2-wire, send it to the chip, the chip extends it to 4-wire again, and sends it to it's JTAG interface.
So, if you want to use a 2-wire interface for flashing and debugging, all you would have to do is adding a 4-wire to 2-wire translation to OpenOCD. This way, you could use any Interface that OOCD already supports, even the cheap USB Blaster clones (5$) from china.
yes, please do that. I'm currently struggling with flashing a PIC32MX220f032B. It isn't well supported by the Microchip tools yet. So your code would ve really helpful, and I'd like to try it.