Well, my money’s sent, and within a few weeks I should be the proud owner of a set of USBKEY header adapters. That’ll be a relief, having to manually probe the serial pad with a multimeter probe is getting rather tiresome.
Along with the success in getting the UID-select mode to automatically detect which mode to initialize the USB system into (depending on the cable inserted, connecting a host cable causes the system to initialize into host mode) I now have the UID interrupt working as well. Starting the USB driver into UID select mode causes it to automatically switch between master and slave as the cables are inserted or removed.
That’s not bad, so I’m now moving onto the host mode again. OTG is just a funky subset of the device/host modes, so that’ll be last (and as far as I am aware, unique as I don’t believe Atmel’s driver supports it) mode to implement.
With a little fiddling, I’ve now got VBUS voltage generation out of the host mode, which causes my USB memory stick to glow a nice blue when inserted. I had to use the manual control workaround in the datasheet, as the “correct” host VBUS control only powers up for 300ms, before timing out if no device is inserted. Rather than have a complicated retry mechanism, I opted for just having VBUS generated all the time, and then just detect the device insertion.

Once complete, I’ll be adding a configuration option to enable the normal VBUS mode, so that a connection with a device can be attempted via a macro, with a second macro indicating success, busy or failure of the connection. That’s for later however, as I want to just get the basics done before branching out into anything more complicated.
I’ve been wondering how much interest in an open source USB AVR driver there is, apart from my own. Anyone else out there planning on using this once it’s done? Anyone?
August 29th, 2007 at 6:02 am
Hi Dean,
I’m working on a project that uses the AT90USB1287. I got a USBKEY from Atmel and then started digging into their USB library. I believe you must have felt the same way I did on examing Atmel’s code and documentation - largely incomprehensible! An Atmel rep stopped by and I mentioned in jest that it must have been written by Norwegians for Norwegians; he replied, no it was written by the French for Norwegians:).
So I was doing a lot of digging around for more info since I was going to refactor the code when I came across your web site. Hallelujah brother! Somebody who had the same idea (a grasp of what public vs. private interfaces are for)!
I grabbed your code and made some minor tweaks to compile under the IAR compiler. I’m just getting around to running some simulations and then I’m going to toss some hardware/code at the hardware engineers and see how it works.
Efforts like yours are appreciated! I’m just focused on device mode for now, but let me know if I can help with the project.
Best regards,
Steve Hidem
August 31st, 2007 at 6:06 am
I definately intend to use your avr usb libraries for some experimentla projects in the very near future.
I guess to start with i will just try to set the LED states on the AT90USBKey from my pc.
Thanks for the code