USBtinyISP

Posted: 1st September 2011 by Quinn Dunki in Hacks

Building Adafruit’s AVR Programmer kit

 

I needed a quick and dirty ISP programmer for a project that was on a very tight deadline. Adafruit’s USBtinyISP unit seemed like just the thing. It’s very reasonably priced, and can be thrown together in about 30 minutes.

This device turned out to be quite a bit nicer than I expected. It’s an in-circuit programmer, it can optionally power your circuit directly from USB, has both types of AVR programming header, and is supported by the latest version of avrdude. This will likely become my go-to programmer, because it’s small, easy, and does almost everything. For projects with a lot of code, it would be nice to have support for Atmel’s new JTAG ICE on-chip debugging. The USBtinyISP is driven by an AVR MCU itself though, so a future software upgrade for JTAG and OCD is possible.

Here’s a quick run-down on the construction of the programmer, in case you’re thinking about building it yourself. I apologize for the soft focus in some of these pictures. As mentioned, I was in a big hurry on this project, and didn’t have time to set up better shots.

The bits arrived in a reuseable (nice touch) static bag, via UPS in a paper envelope. The latter would be my only complaint. Some components were slighly damaged due to the minimal packaging. There were some bent IC pins, and one of the ribbon connectors had a loose connection in it.

The instructions are very thorough. They are fortunately also easy to skim, since they are targeted at a novice audience.

The PCB is top-notch quality, with silk-screening and through-plating on the component holes.

The MCU is socketed, which makes future upgrades easy. I hope they materialize!

The high quality of the PCB makes assembly go very very quick.

Here's the final board. The instructions are a bit fuzzy (much like this photo) on one thing. The height of the LEDs should be 1/2" above the PCB, measuring to the underside of the LED. If you measure from the top of the LED like I did, they'll be too short. They're still visible, but I wish they were moreso.

Here's the final product. Note the six and ten-pin headers. That's quite nice since the six-pin is the new standard, but the ten-pin is still very common on development boards. If you're rolling your own development board, the six-pin boxed headers are a bit scarce unless you order from the major online distributors. I like to use my local surplus shop.

To test it, I threw together a little interface on the breadboard. You could just as easily stick solid 22 AWG wire into the holes of the six-pin ribbon connector for a one-off test. I needed to do a bunch of iteration in a hurry though, so this quick-and-dirty rig did the job.

I had some trouble getting the programmer to work the first time. There turned out to be two things tripping me up. First, the six-pin ribbon connector had a loose connection in it. Second, the ribbon was connected backwards from what I had seen elsewhere (here, for example), so the pin order wasn’t what I expected. ┬áNot that there’s a “right” way for the ribbon cable to be oriented relative to the connector, I just assumed wrong. Anyways, the point of all this is that the Adafruit forums were quite helpful in tracking down the problem. I found plenty of information on there for diagnosing common problems, and I ultimately got it working.

One final note on setting up avrdude for this programmer. It’s important to have the latest version, and if you’re on a Mac, there’s a lot of conflicting information on the web about installation. There are a couple of different distributions out there, and some are out of date. Adafruit has extensive installation and build instructions on their site, but I would honestly just skip all that and install CrossPack. I would have saved myself a lot of grief if I had started there.

In case you skimmed that, to get avrdude running on a Mac, install CrossPack, and nothing else. It’s free and will just work. Done and done.

Here’s a simple command line to test the programmer (assuming you’re using an ATtiny13A, like me):

avrdude -p attiny13 -c usbtiny -n

If something is wrong with your programmer, you’ll likely see this:

:(

99.999% of the time, that error message means the programming header is not correctly wired to the pins on the chip being programmed. Check and recheck, as it can get confusing. If you’re not sure which pin is which on the chip, check the summary data sheet from Atmel. For the header connections, here’s a nice summary of the possibilities. If your wiring is correct, check the Adafruit forums for more help.

If everything worked, you’ll see this:

:)

 

So now you might ask, what was I building in such a hurry with an ATtiny13A? More on that later!

  1. KenS says:

    I have one of those too. One small gotcha, they can’t program devices over 32K (or is that 64K?) I know they DON’T work with the atmega64, 128, 1280, 1281, 2560, and 2561 devices. I think there is a patch for avrdude to allow that, but what the patch REALLY does is to ignore errors during the verify cycle. SO since I do use those 64k and up devices I’m glad I repaired a broken AVR JTAGmkII that I was given. (Ugly Frankenstein type repair to replace a missing probe cable and jumper out a blown fuse and burned board traces).

    • Johnny Starr says:

      Will this work with programming the Arduino bootloader?

      • Quinn Dunki says:

        I imagine so- it’s capable of flashing the entire program memory and EEPROM of the AVR chip that is in the Arduino, so you should be able to put any code you want in there, including a new bootloader. I don’t have much Arduino experience myself, though, so I can’t say for certain.