EVENT: MyUSB Refactoring
Well, I’ve got the serial output for MyUSB working perfectly. In order to suit the needs of the end-user, there’s two (mutually-exclusive) serial drivers in the MyUSB library – one simple polled system and another using the streams in <stdio.h>. Since the USBKEY uses a MEGA128 on board, for simplicity I’ve opted to use the latter in the demo code (and for my own experiments) as it simplifies the code and speeds up the development.
Using a Macgyver approach involving breadboard wire and a multimeter probe, I’ve been able to view the serial output on a seperate graphics LCD. That’s been very handy – I can now see what’s going on from a more abstract view that my JTAG offers. The difference is error messages verses register examination, and both tools combined makes development much more pleasant.
After a bit of swearing and hard effort, I’ve refactored the main low level USB code to a much nicer method, which will allow for mode switching via the UID pin of the USB plug. That’s a neat feature of the new mini USB sockets – USB-A style plugs now ground a fifth USB wire which can trigger an interrupt to change over to host mode and vice-versa. That should also help troubleshoot the host mode — I’ve added a new event to the event hooks header file which give error information when the USB system fails to initialize.

Loading...