Fri Apr 1 00:00:39 EDT 2011

PICkit 2

While the PK2 is being phased out by Microchip to be replaced by the
PK3, it is still a neat toy.  The 2.x firmware (last one is 2.32) is
essentially a small scripting interpreter that contains primitives for
data communication and voltage control.  Its best feature is that it
is fully documented.  It is currently still available from Microchip,
but will probably remain available for a while as a clone[1].

Due to its versatility, the PK2 has been used for many alternative
purposes, which might be the reason why Microchip is phasing it out in
favor of the PK3 which doesn't have an open architecture.

I started writing a driver for use of PK2 in Staapl a bit after the
PK2 came out.  I gave up after not getting it to work relyably and
moving to other projects.  Recently however, Jaromir Sukuba published
a description of the non-documented PIC on-chip debugger features[2]
which has revived my interest in getting the PK2 to work with Staapl.

The main issue I had was the hassle involved using both an ICSP port
and a serial console on a PIC with low pin count.  Moving towards
console + programming on only a single port would simplifiy some of my
development setups.  With info on the debugger available I finally
traded some sleep for getting it to work.

So it works now.  Staapl talks to a PIC over the ICSP connector.

The current downside is that it's not particulary fast in practice due
to the nature of the handshake protocol I'm using, which ping-pongs
across a 1ms USB delay.  However this is not intrinsic to the PK2 as
it does work well for single-direction burst transfers.  Some long
tail work TODO there.

[1] http://shop.ebay.com/?_nkw=pickit2
[2] entry://../electronics/20110320-225422