Wed Feb 11 15:44:46 CET 2009

state machines / USB

Before finishing the USB driver, there are two more general tasks to

  * Figure out an approach to create state machine abstractions.

  * Refine the compiler which translates a highlevel device
    description into code that answers queries about it.

Keep this in mind: during device setup code doesn't need to be fast,
so it is better to aim for the right language abstraction instead of
trying to write optimal code, as I did before.

This is going to make the water muddy for a while, as I can anticipate
some problems.  One in particular is "require" in combination with the
way macros work in a flat language.

 1. Build 18F2550 hardware setup. (USBPICstamp)
 2. Setup USB debug on host side.

Let's make this into a story about how to write a resonably complex
application with Staapl's macro approach.

-- Getting it to run

tom@zzz:~/staapl/app$ staaplc -u -d pk2 452-40.f
loading PICkit2 device file.
pk2-open: PICkit 2 Microcontroller Programmer
program: 532 bytes
config: 14 bytes
(Vdd 4.814453125)
(Vpp 11.9072265625)
uart-start hack
Connected (pk2 19200)
Press ctrl-D to quit.

The same one for the 2550 doesn't work.  Some 1220 boards also do not
work, so I think this is a circuit issue.  What I do miss here is a
memory verify operation after programming.  Let's build that first.

Ok.  Apparently the 2550 doesn't allow flash write.  I think this is a
boot-protect problem: need to disable boot protect in config before
writing is possible.

Apparently this was the problem:
#x30000000 org  \ wrong
#x300000 org    \ right

Will add warning when there's no config memory.

I have to program it with
 pk2cmd -I -p PIC18F2620 -F logan.hex -M

Also, the console will only come up after one ctrl-C