Fri, 12 Nov 2010
It just took me the better part of a day to find out why my o-so-simple microcontroller couldn't be programmed. I've this really simple board, consisting basically of a ATmega8 or ATmega8l, a 6-pin standard ISP connector and some surrounding power supply parts (no external clock).
Now, if you take a ATmega8 from the reel it comes pre-programmed to run with 1 MHz from the internal oscillator. Trying to access and program the device connected to an STK500 SDK using avrdude always resulted in errors:
avrdude: Device signature = 0x010305or
avrdude: Device signature = 0x010307Strange. Because normally you can either program the device or it doesn't respond at all (0x010301 and 0x010304 also turned up sometimes, in AVR studio speak: 0x01 0x03 [0x05,0x04,0x01].
I double checked all solder connections and even tried three (!) different devices on different PCBs, even from different production lots. Always the same error.
Meanwhile I had already checked the STK500 against other development boards equipped with an ATmega168 and ATmega8 - those worked.
Finally I dug out an old Windows XP machine running the AVRstudio, and there it occurred to me:
To speed up programming, I had increased the ISP frequency from default 115.2 kHz to 460.8 kHz. Turns out that the fine print says, that the ISP frequency should be lower than 1/4 of the microcontroller clock (1 MHz in this case). 1 MHz / 4 = 250 kHz - so I was well above. Turning the frequency down to 115.2 kHz made everything magically work.
avrdude: Device signature = 0x1e9307 avrdude: safemode: Fuses OK avrdude done. Thank you.
I hope to save someone else some time with this post