[flashrom] Add PICkit2 as an SPI programmer

Justin Chevrier jchevrier at gmail.com
Sun Mar 24 16:10:19 CET 2013

>From the 'You can never have enough programmers' file, comes support
for another programmer type.
Specifically it's the PICkit2. This patch was inspired by the code in
AVRDude (open source Atmel AVR
programmer) to support the PICkit2 written by Doug Brown [1]. The
Dediprog code in Flashrom was used
as the template for this code with some reference to the ft2232 code
as well. I left Carl-Daniel in
the copyright assignment as I thought it made the most sense as I
basically copied and pasted then
modified the code as needed. Hopefully that was the right thing to do.
A few notes:

1) The code makes no provision for externally powered targets (where
VDD from the PICkit can be connected to
the device and an external power source and it will detect external
power and not apply its own).
I'm assuming that code needs to be written for this to work and that
the PICkit itself doesn't make it happen
automagically. Not sure on that one

2) I've tested with PICkit2 firmware version 2.32. I suspect that
there are earlier versions of the
firmware that are not capable of talking SPI, but I'm not sure. Should
we include a warning if we detect
that a user is running on older firmware and ask users to submit if
their firmware version works
for them?

3) I've only tested with the one easily accessible SPI chip I have on
hand (GigaDevice GD25Q80)

Connections are as follows:

PICkit2 Pin 1 - VPP/MCLR -> CS
PICkit2 Pin 2 - VDD -> Vcc
PICkit2 Pin 3 - GND -> Vss
PICkit2 Pin 4 - PGD -> SO
PICkit2 Pin 5 - PDC -> SCLK
PICkit2 Pin 6 - AUX -> SI

Feedback welcomed! Hopefully this is useful to someone.

Thanks for the great tools as always guys.


[1] - https://github.com/steve-m/avrdude/blob/master/pickit2.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pickit2_flashrom_patch.diff
Type: application/octet-stream
Size: 17092 bytes
Desc: not available
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20130324/3e80fefe/attachment.obj>

More information about the flashrom mailing list