Tue Aug 26 19:36:45 CEST 2008

PK2 replies

box> ,staapl (enter! "staapl/pickit2/pk2.ss")
box> (open-pk2)
box> (pk2 GETVERSION)
(2 32 0 41 64 181 68 24)

That's firmware 2.32.0 and some other stuff.

got minimalist interpreter.ss working so commands and scripts can be
created conveniently:

box> (pk2-cmd
       (pk2-script (VDD_OFF)
       (pk2-script (VPP_PWM_OFF)
(166 2 254 253 166 2 248 250)

Reply works too.

box> (pk2-cmd (GETVERSION))
(2 32 0)

Ok.. this is complete overkill, but it was fun :)

Something doesnt seem to work:

box> (pk2-cmd (EXECUTE_SCRIPT (pk2-script (READ_BYTE_BUFFER))))
box> (pk2-cmd (UPLOAD_DATA))

Changed names to 'script-begin and 'command-begin, cleaned up the code
a bit more and concatenate all replies from executing multople
commands in a single 'command-begin.

Next: test the serial output.

It's pretty clear that something doesn't work with executing scripts:
This doesn't turn on the led.

box> (pk2-script (BUSY_LED_ON))

From the manual: "RUN_SCRIPT and EXECUTE_SCRIPT commands will be
ignored when any of StatusHigh bits 7:1 are set"

Apparently, status needs to be read before it works.

Ok, going to have some more fun.  Now I got the interpreter macros,
but they behave a bit awkward for composition.  I'd really like to
model the instructions as functions.  Let's organize the namespaces so
the commands can be in plain sight.

This works pretty well! Got free tab completion and all :)