github/sowbug

The programmer works!

The boards tagged DORKBOT_1_0_1 arrived on Monday. I’d somehow forgotten to order the NX8045-package crystals, so I had to solder a temporary, silly-looking HC49 crystal onto the board. But otherwise, assembly went fairly smoothly.

I followed the usual order of PCB population: add the power circuitry first, then power it up and read testpoints. All was fine. Then the “expensive” (i.e., two-dollar) parts: the ‘32u2, the buffer, and the sockets. More continuity testing, some examination under the USB microscope for solder bridges… and then fingers crossed while I plugged it in to USB.

Success! Or at least, as much success as I could detect at this point, which is to say I didn’t smell smoke.

I first connected it to my USBtiny and read the default fuses (5e d9 f4), then tried changing the lfuse to use the internal oscillator (avrdude -c usbtiny -p m32u2 -P usb -U lock:w:0x3F:m). No luck; avrdude kept reporting “verification error; content mismatch,” and the fuse stayed as-is. I ended up looking at some other avrdude command-line invocations on the web and realized that (1) the lock fuse had been preset to disallow further programming, and (2) I had to erase the chip with a -e flag to undo that fuse. Achievement, and fuse, unlocked.

Next, installing the bootloader. I built LUFA’s CDCBootloader, then wrote it: avrdude -c usbtiny -p m32u2 -P usb -v -e -U flash:w:BootloaderCDC.hex (by this point I think the -e was implied, but I spelled it out anyway). I then disconnected the USBtiny, plugged the programmer into USB, and saw /dev/tty.usbmodemfa121! My programmer was running code!

Finally, making the programmer a programmer. I built the LUFA AVRISP mkII clone, then wrote it (**avrdude -p m32u2 -P /dev/tty.usbmodemfa121 -c avr109 *-U *flash:w:AVRISP-MKII.hex**). The serial device vanished, as expected. My computer’s System Information informed me that an AVRISP mkII had just joined us, and I was able to read from and write to a target 328p on an Evil Mad Science breakout board.

I now know that feeling one feels when a fabbed circuit works on the first shot. The feeling is mostly surprise… and mostly delight.

P.S. Will someone please tell me why I’ve been wasting my time using anything but CrossPack?