Keyboard Host
Hurrah! Today, after much swearing and reverse engineering, I managed to get a USB keyboard to enumerate via MyUSB, and print out the typed alpha-numerical letters onto the display. It’s still not quite done, with a few more refinements left to do, but at least it works at all.
The mouse host code may or may not work – I lack a 9V battery which has enough oomph to power the mouse. Once I get a 6-AA to 9V adapter I should have plenty of power for testing devices.
As usual, I couldn’t have got it working at all without the reference Atmel driver to study. I’ve had lots of trouble trying to get the algorithm right, and was only illuminated on thi occasion after I had a look at Atmel’s driver. It turns out that after each control transfer, the FIFOCON bit must be cleared to reset the pipe’s buffer. That’s the exact opposite of the datasheet, which states that the FIFOCON bit should not be altered by a control pipe. Little things like that make me wish very hard for a final version of the USB1287’s datasheet, so I have a correct, concrete reference to guide me.