Well, the Wiki is up and populated with the majority of the MyUSB project details. I’ve already had to make changes to the information available, and I already think it’s a great idea as a publicly viewable, easily editable information platform.
Today apart from doing a small amount of more commercial work for CC Communications, I worked hard on MyUSB. I’ve added in event hooks, which when configured can execute code in response to USB events (see the USB Interface documentation for the current list of available events). My original idea was to implement blank stub functions that had the GCC “weak” attribute, so they could be over-ridden transparently in the user-application. This worked great — but the weak stub function was included in the resulting binary.
A few wasted bytes isn’t too bad, but I thought I could do better. I then made the stub function inline, hoping the optimizer would remove the stub function entirely when a stronger function was substituted. This actually made things worse, with both inline and normal functions cluttering the binary.
I finally settled on a basic system using a control header file which defines the event names as either statements, code blocks or function names. Events that are unused get the value NO_EVENT_HOOK (an empty ASM statement) so that code such as:
if (SomeEvent)
USB_EVENT_SomeEventName();
Doesn’t cause problems by being empty.
I’ve had to contact Atmel support yet again, on the endpoints issue. I have many of the USB interrupts and events working great, however the control endpoint doesn’t seem to be recieving any control data. My JTAG shows why this is - the endpoint seems to be destroyed when the device is attached to the USB bus - but why that is is a mystery to me. I did find that I was accidentally setting a bit which was forcing the USB controller to run in Host mode, but changing that hasn’t fixed the problem.
Once the control endpoint is up and running, adding the control command interpreter should be easy - very similar to the V2Protocol work I did for my ButtLoad project.
Recent Comments