The Genearic HID tool is meant as an easy way to create your own human interface devices. The project has the added benefit of showing us how to hack the hardware on the AT90USBKey developement board. The AVR-based device, which we saw used to make an SNES cartridge reader, comes in at just over $30 but with a few caveats. First, the breakout pads for the pins are not 0.1″ pitch and require some creative soldering to get at them easily. But the walk through also covers converting the board to run at 5v when in USB host mode, and altering the populated components to reclaim pins on the AT90USB1287 chip. The fun isn’t limited to this board, there’s also a home brew alternative based around the same chip.
12 thoughts on “Working With The AT90USBKey”
One thing I like about the PIC microcontrollers is that they have through-hole DIP models with USB built in (e.g. the 18F4550 and the 16 bit 24FJ64GB). For less than $7, you get a one-chip, hobbyist-friendly solution for connecting to a PC.
I only wish that sort of convenience was available from more vendors.
Bob, now that it’s been mentioned, I wouldn’t be surprised if someone at TI is working on it!
I just switched a couple months ago to AVR, from using the PIC 18F series (4550’s primarily). The ability to use AVR-GCC was what really pushed me over — I’ve moved away from Windows for *all* of my development, and booting up a Windows VM just for MPLab and PIC_C18 (which are… less than pleasant experiences compared to a GCC-driven workflow) was a pain that I was more than happy to eliminate. I haven’t checked out the Generic HID project (looks pretty nice, will be experimenting with it myself), but what I have found to be useful is the LUFA project (Lightweight USB Framework for AVR’s, found at http://www.fourwalledcubicle.com/LUFA.php). It’s pretty awesome code (with excellent commenting to match), with a lot of different profiles (different HID’s and other device ID types, as well as a lot of host stacks); and it all works pretty well with the AT90USBKey’s bootloader. The weird headers used on the AT90USBKey do present a problem, but I ordered a bunch of matching connectors and it’s not a huge deal for me now. I do like what they did in the linked article; might try that myself.
@over-engineer, you should post what part numbers you used as the headers are very odd as their 50mil pin spaced but 100mil between rows and I found no suitable connectors. I ended up using 30guage wire and some vero board and just soldered to every pin, a bit of a mess but it works quite well now.
@everyone else, the ‘Wizbang Wings’ that you see in the top solution is the best but the website no longer works and I got no response from him on the AVR Freaks forum so you will need to make your own and they cost about $18 which sucks.
The 16kB AT90USB162 part is far cheaper than the AT90USB1287 used on the AT90USBKey and will likely do what you need with respect to USB. Mouser: qty.-1, AT90USB162-16AU, $3.55 ea. vs. qty.-1, AT90USB1287-AU, $9.24 ea.) Also, there is a slightly cheaper 8kB AT90USB82. Both come in an easy to mount TQFP-32 package. The chips come factory flashed with a boot-loader.
You can’t beat the free no-restriction Win-AVR/AVR-Studio C/C++/ASM development/debug/simulate environment compared with anything similar from the likes of Microchip or TI. The one instruction per clock RISC architecture of the AVR line is as fast as it gets in terms of mainstream micro-controllers (e.g., ATTiny’s run at 20 MIPS). Mainstream PICs in comparison take four clocks per instruction.
Finally, the $49 ATMEL AVR Dragon board is an incredibly powerful ISP/HVISP/JTAG programmer/debugger that is no longer target size limited. Anything you read about the Dragon being fragile is old, the first run of boards long ago were a bit dicy; anything you buy today is robust.
Yeah, I’m an ATMEL AVR fan-boy – for good reason. No, I don’t work for or with ATMEL.
Happy Trails, Drone
@over-engineer : I was pretty frustrated with using the PICs because of the windows thing as well.
But as long as you’re willing to put in the effort, you can compile the sources for the dsPIC30F and 24 series PICs here: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023073
And if you’re using a PICkit2 or an ICD2 you can upload code using piklab.
Admittedly I’m a pic person through and through, but that’s mostly because I got started with them and have learned to use them *very* well. I’m working on adding ARM to my repertoire, but AVR hasn’t had enough appeal to pull me into buying a programmer and dev board. When I say it hasn’t had enough appeal I just mean that I haven’t seen enough advantages to warrant it over the PICs I already know and love!
Also Teensy: http://www.pjrc.com/teensy/
@over-engineer and @Drone, I agree: Microchip’s MPLAB IDE stinks. Why they won’t base their IDE on Eclipse is a mystery to me.
@Drone, the AT90USB162 looks like a great part. If only they’d offer it in a DIP, I’d switch from PIC to AVR in a heartbeat. But you can’t plug a TQFP into a breadboard, and I have a tremor in my hands that makes it difficult to solder surface mount devices.
Until I can get USB-capable MSP430s or AVRs in a DIP, I will have to put up with Microchip’s pathetic IDE and stomach-turning 8 bit architecture.
You can buy or make a TQFP adaptor to plug into your breadboard, or you can buy a board like Teensy. (yup, a shameless plug… I’m affiliated with PJRC) An adaptor with the crystal and USB on-board saves breadboard space and gives you cleaner signals too.
Really, how many copies of the same design are you going to hand wire on breadboards? You only need to buy or build one adaptor, or maybe a few if you’re doing lots of concurrent designs. Yeah, it costs a tiny bit more, but in the grand scheme of things, under $20… probably less than you’ve invested in breadboards, wires & hand tools.
Later, when/if you’re ready to make a PCB, those TQFP parts work out pretty nicely!
Teensy does seem like a nice board, and is probably going to be what I order for the next board to put into a project — looks about as good as (if not better than, in some ways) the AT90USBKey, so I’m looking forward to a project that will justify ordering one.
I was a PIC guy for probably about five years (learned a lot about them, and built a lot of projects with them), but certain quirks in the architectures always bothered me. The dsPIC/30/24 series all sounded pretty interesting to me, but after reading about the AVR’s, plus the advantage of the AVR-GCC toolchain, PLUS reading the code for LUFA (seriously, it’s like the Microchip USB sample projects on steroids), and finding the low cost AT90USBKey (didn’t know about the Teensy at the time), I figured it was as good a time as any to switch. I really couldn’t be happier; PIC got a lot of projects done for me, but AVR is *so* much more pleasant to work with. Also, I can’t speak to the one on the Teensy’s, but the AT90USBKey comes with a great, stable USB bootloader (much more usable than the one from Microchip for the PIC 18F’s, in my experience). I have heard that Teensy is similar in this regard, but I haven’t used it myself.
As for the mating connectors, the ones that I found are from Major League Electronics (had never dealt with them before, but they have great customer service and were the *only* ones with a 1.27mm (0.05″) pin spacing, dual-row 2.54mm (0.1″) row spacing header design that I could find in small quantities). If my notes here are correct (they are :P, but you may want to take a look at the data sheets to make sure the options are how you want them; these are what I got and they’re working well enough), the part numbers are:
TSHS-605-D-05-A-G-LF — This is a male header, straight pin, 2×5 (a match for the six ports). This is what I populated my AT90USBKey with — they’re quite snug, actually… a very tight fit. I did much of my early development (they arrived two days after the Key itself) with them loose-fitted in because a friend happened to ruin my good soldering tip.
LSSHS-605-D-02-G-LF — This is the matching female header. Snug fit, some prototyping projects could easily hold onto the board well enough by aligning a few of these together, similar to a “shield” configuration — that’s how I’m designing some of my boards. This is a straight-leg part — you can get them bent for surface mount designs, but I don’t have that part number here with me.
Working on a PCB design for “wings” similar to those in the linked article, based on these part numbers; would be very useful to have such an adapter, but the company who made them is no longer in existence on the ‘net, it looks like. I’ll post designs here, and maybe throw them on batchPCB or something so people can order a set easily on the cheap. Simple enough, should be able to whip out the right footprints in an hour sometime this weekend.
I have been looking into making DIP adapter boards for AT90USB chips. I have also been looking at PIC 18F chips as they come in DIP format.
I am more familiar with AVRs and they are more powerful due to hitting nearly 1 MIPS per MHz than PICs. As other have said the development environment is also a lot better than MPLAB. On the downside they are not available in DIP… I have hand made about 40 Retro Adapters which use ATmega168s in TQFP format and while not too hard to do it is certainly a lot slower going than DIP. You can’t just grab a bit of matrix board either.
Cost wise they two are actually fairly similar. The AVR needs slightly more external hardware (resistors on the USB lines and one capacitor) and a PCB, the PIC costs more to start with.
If I do go the PCB route I will sell them on at pretty much cost price with the AVR pre-soldered on and loaded with the standard Atmel bootloader (or perhaps the LUFA one).
If anyone is interested post here or email me directly (email@example.com) so I can gauge demand.
I have two new in box AT90USBKEY kits. Anyone interested? I would sell for $5 under current Digikey pricing including shipping. I need to reduce all my stuff laying around.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)