Hello to everyone,
Just before giving up, really frustrated, almost mad with anger...
I ask any of you that can suggest me a workaround other than building another test board... or doing away with AVR stuff altogether.
I have designed and built a prototype PCB with an ATmega644A-AU and a crystal at 9.216 MHz with 22 pF capacitors connected to it.
The '644A is connected to an LCD and a Dataflash(TM) memory through SPI.
I use STK500 with AVR Studio 4 to program the '644A using ISP. My code is written in C.
My nightmare started when I mistakenly set the fuses; my '644A was "bricked" and I could not bring it back to a functional state.
After browsing through the forums here, I built a crystal oscillator using 4011 on perfboard and successfully revived the microcontroller; this time, I selected "Ext. Crystal Osc. 8.0 - MHz" on AVR Studio.
After downloading code to the microcontroller, I noticed that operation was erratic. The whole system kept resetting at a rate that was not stable, however this happened rather frequently (once in a minute or two, I guess). That erratic operation seemed to happen even with a very simple program that just displayed text on the LCD and nothing more than that.
I tried to measure the clock signal on XTAL1 pin of the '644A using a "vintage" 'scope (Tektronix 454; okay, I know that in that way, the oscillator is loaded with the probe impedance, but it is a quick way to check if anything happens at all). Amplitude was small, less than 1 V. I thought that I should use the "full-swing" fuse option, but when I had set that earlier that day, I got the microcontroller "bricked " again and I had to revive it using that crystal oscillator I built.
I spent many, many hours last morning browsing through the forum trying to find a clue to that strange problem. Almost everyone stated that full swing should be used at clock rates above 8 MHz. Indeed, this made sense.
Later, in the evening, I tried to program fuses but without success. I tried removing the crystal, the capacitors connected to the crystal's terminals, soldered the crystal back to the board (2 or 3 times; I really don't think it should be okay to do it once more) with the external crystal oscillator connected to XTAL1 pin of the '644A. Even with ISP frequency set to 1.2 kHz (minimum), no communication could be established between STK500 and my '644A.
I tried soldering a 10 nF capacitor across ~RESET pin and ground (I have a button switch for resetting the microcontroller; I placed the capacitor between the two terminals of the switch) after having gone through AVR042 for another time. It was at that point when I noticed that my '644A kept resetting at a constant rate, for I thought of placing the 'scope probe on the ~RESET line and check what was going on there.
Following that, I thought of desoldering the microcontroller and replacing it with another one; I tried to do so, but I could not do that. I cleaned the PCB from all that flux thoroughly, hoping that things would be better. However, no luck again. I cannot revive the microcontroller using the external oscillator.
All I have now is a non-working prototype with a microcontroller that keeps on resetting; having the STK500 connected through the ISP header has no effect to that.
Can you please suggest me what I can do to recover fuse settings on that microcontroller that keeps on resetting?
Is "full swing" the correct setting for a 9.216 MHz crystal?
Why is the microcontroller resetting all the time?
Is it possible to destroy the clock circuitry in the '644A by applying an external clock signal to recover fuses?
P.S.: It is not the first time I build a PCB with an AVR; earlier this year, I had build another prototype using exactly the same microcontroller and a slightly different crystal (10 MHz and without pin for grounding the case). Everything worked fine! But I did not copy the fuse settings and now I had to go through all this...