I just recently started playing with microcontrollers so I'm quite ignorant about them, but I'm learning. :)
I have a couple of ATtiny45s, a couple of ATtiny2313s and several ATmega8s and ATmega8Ls. So far I'm focusing on the tinies to learn the basics and whatnot. My set-up consists of an AVRISP from DigiKits.com (essentially a CP2101 USB-to-UART adapter, with an ISP connector built-in and connected to the right pins; it is seen as an STK500v2) and avr-gcc + avrdude on OS X.
With the ATtiny2313, everything went fine and I actually built a little thing it. With the ATtiny45, though, I have some serious problems I can't figure out.
When I flash a small program, say under 150 bytes or so, everything goes smoothly: it erases, flashes and verifies perfectly. For instance, this hex works:
:100000000EC028C027C026C025C024C023C022C0DF :1000100021C020C01FC01EC01DC01CC01BC0112499 :100020001FBECFE5D1E0DEBFCDBF10E0A0E6B0E05F :10003000E4E6F0E003C0C89531960D92A036B10712 :10004000D1F710E0A0E6B0E001C01D92A036B107E4 :10005000E1F701C0D5CFCFE5D1E0DEBFCDBF8FEF57 :0400600087BBFFCF8C :00000001FF
When I try to flash something bigger, the programmer enters a coma state right after sending the bytes to be flashed, to the point that avrdude reports timeouts from the programmer. At that point I can't even kill it, and ps (the process viewer!) reports it as "E", which means "trying to exit but not really succeeding".
This is a hex file that does that:
:100000000EC028C027C026C025C024C023C022C0DF :1000100021C020C01FC01EC01DC01CC01BC0112499 :100020001FBECFE5D1E0DEBFCDBF10E0A0E6B0E05F :10003000E0EBF0E003C0C89531960D92A036B10711 :10004000D1F710E0A0E6B0E001C01D92A036B107E4 :10005000E1F723C0D5CFC198882311F4C09801C01F :10006000C09AC19A08951F93CF93DF93182FC0E0D1 :10007000D0E0812F99270C2E02C0880F991F0A9477 :10008000E2F7E9DF2196C830D10599F7DF91CF91EA :100090001F910895C298C29A0895CFE5D1E0DEBFBE :1000A000CDBF8FEF87BB84E6DEDFC298C29AFFCF59 :00000001FF
The flash write seems to work (I'm not entirely sure as I was building that program a piece at a time, checking that everything worked as expected), but the flash read for the verification process doesn't even start. Inhibiting the verification stage times out anyway, as it can't read the fuses.
I put a log (with -vvvv) of what happens at http://jollino.it/stk500ko.txt, maybe someone can make some sense out of it.
I am running avrdude 5.3.1 installed through macports, but I also compiled 5.5 on my own and the problem doesn't change.
From the little understanding I have (so far) of microcontrollers, it can't be related to bugs in the source code of the hex file, as avrdude merely send streams of data to the chip to have it flashed into its memory. Then why does this happen?
I also noticed a weird thing: with the ATtiny2313, the programmer worked fine even without powering the circuit (isn't that weird?). With the ATtiny45, it has to be powered up otherwise it will not work at all.
I have been researching on the net, but I haven't found anything that could apply to my problem. Of course, it might also be a matter of not searching properly... in which case I apologize.
Any hints would be greatly appreciated. :)
Thank you very much in advance!