Tonight I reached another milestone on my way to world domination, in that I managed to 1) Assemble the USBasp AVR programmer I ordered and 2) build up a very simple setup for the ATMega644 (which is a possible target system for my hardware sequencer project) and 3) program the ATMega644 with avrdude via the USBasp programmer.
The experience was okayish with some more nightmare-style elements. The bad thing about doing all this stuff without proper measurement equipment (like a scope) is that you can only hope that nothing goes wrong. So you doublecheck every soldered connection and still, in the end, you miss that one connection that f**ks up the whole setup. What’s worse, you are always living in fear that you totally destroyed one vital component. When I started up avrdude for the first time, nothing happened. When I had successfully flashed the 644 for the first time, I went through quite a few “oh-no” moments:
- When I tried to figure out what was wrong, I somehow created a short circuit which forces the Mac hardware to temporarily disable the USB port. Luckily. no hardware was harmed so far.
- When I thought I had everything fixed, my Mac didn’t recognize the USBasp hardware anymore. Later I found out that the AVR of the USBasp was not sitting tightly enough in the socket.
- When I thought I had everything fixed, the Target (the 644) was responding with Device ID 0×0000 all the time (which is checked by avrdude and makes it bork). After some more or less random diagnosis shots, I found a loose connection on an adapter board I soldered earlier to connect the ISP header on the breadboard. And I thought I had them all checked (both optically and electronically) twice.
- When I thought I had everything fixed, I once more went through the “IC not sitting correctly in the socket” cycle.
- When I thought I had everything fixed, I learned that it’s a good idea to set the “Slow CLK” jumper on the USBasp, because the device runs on it’s own, slower oscillator as long as you don’t set the right fuses, even if the oscillator is connected. I thought that the internal oscillator should be fast enough to keep up with the USBasp, but no cigar.
- And suddenly, everything was working.
So, what’s next? Building a standard 5V power regulation circuit, building a permanent setup for the 644 with headers for ISP and UART (in the hope that the cable I got on ebay will arrive not before long), and then building Midibox DIN clones with the 74HC165 I have lying around and the Resistor networks I got today, so that I can read out some more rotary encoders.
And now I’ll get myself another shot of cranberry fusion. :)