Category Archives: annoyances

Hooray for old firmware in shipping hardware :-P

A while back, I picked up a cheap Chinese knockoff of a usbASP programmer from Amazon…originally, it was to replace the crummy factory-installed firmware on the Anet A8 motherboard with Marlin. The programmer did its job at the time and was forgotten about for a while. (The A8’s motherboard, meanwhile, crapped the bed after I had only had the printer up and running for maybe a month. It’s long since been rebuilt into an AM8 and the electronics have likewise been through several upgrades, most recently to an SKR 1.4 Turbo with TMC5160 drivers just this past weekend…but that’s getting offtopic.)

I pulled the programmer out again to try configuring some ATMEGA328s for a project. They’re empty chips ordered from DigiKey a while back, and I figured I’d try throwing Optiboot onto them. This should be a simple matter of popping the ATMEGA328 off of an Arduino Uno, plugging in one of the empty chips, plugging the usbASP into the Arduino’s ICSP header, and invoking avrdude with the right options…right?

The programmer wasn’t having any of that. With the preprogrammed chip in the Arduino, avrdude identified the chip, read out the fuses, etc. With an empty chip, it wouldn’t read out the chip ID properly. It said something about not being able to set the clock speed and that an upgrade might fix it.

The homepage for the usbASP had some firmware images, so I grabbed the newest and flashed it according to these instructions. The clock-speed error was gone, but it still wouldn’t work. I tried swapping in other Arduinos and still had no luck.

A bit of poking around led me to this fork of the usbASP firmware, last updated just nine days ago. (By comparison, the “update” I had previously applied was already ten years old!) I burned that to the usbASP, popped an empty chip back into the Arduino Uno, and fired up avrdude. Success! I burned Optiboot, set the fuses, and switched cabling on the Arduino so it was connected with just a USB cable (as usual) instead of the usbASP. The Arduino IDE saw it; I was able to send the “blinky” example to it and get the onboard LED blinking.

I was also able to diddle the fuse settings to change speeds from 16 MHz down to as low as 1 MHz and to run off the internal oscillator instead of an external crystal. I have a stepper-motor tester I started building a while back that was stalled when I think I misprogrammed the fuses and switched it to crystal operation in a circuit with no crystal. Now that the programmer is properly sorted out, I think it’s time to dig up the parts and finish this project.