On and off for the last few weeks (IMCFT, what with work being in Busy Mode), I've been trying to add support to AGROS for the USB device interface on the LPC2148 (and thence the LPC23xx and such).
Well, it's been frustrating. The NXP documentation isn't very good, and the various sample code isn't set up to show just how the interface actually works.
Eventually, looking at Micrium's code, I figured out what I think is the last bit of magic: Set Address needs to have the command issued to the protocol engine once (so it takes effect on the next Setup packet), not twice (to take effect immediately), and the Set Address command needs to be ACKed with a zero-length packet.
Anyway, instead of seeing a half-second (or five-second) timeout and bus reset as with the various b0rked attempts, I'm now seeing a Get Configuration Descriptor command immediately after Set Address... and I'm not responding to it, because I haven't built a configuration descriptor yet.
Off to do some real work now (you know, the kind that pays the bills). Once I get my USB driver working properly, I expect I'll post some nice sample code that shows just how the interface gets used.
Having USB device support in AGROS may come in handy for real work soon... toss in an ACM layer and a SCPI interpreter, and it looks like part of a line of quick'n'easy custom test equipment.
(Update: the USB class for something that speaks SCPI should of course be TMC, not ACM. I think I have a copy of the TMC spec squirreled away somewhere... and it can't be any more perverse and incomprehensible than the ACM spec... can it?)
Recent Comments