ATMega32 Issues

Thread Starter

electronics wiz

Joined Mar 15, 2007
54
First off, I would like to apologize to the fact that a lot of my previous posts have been very "unofficial".

Now on to my problem, I have an atmega32 hooked up to a 7805 regulator with a 10uf decoupling capacitor. I have my stk200 parallel port programmer hooked up to the regular mosi, miso, sck, reset, vcc, and gnd pins. I use pony prog with avr isp selected.The problem is that usally the chip refuses to program, resulting in an error in pony prog "missing or unreconized device -24". Sometimes if I move the chip to another breadboard it programs a few times. When I tried the above setup with an attiny2313 it programs fine every time.

Thanks, Electronics wiz
 

hgmjr

Joined Jan 28, 2005
9,027
Since you are using the internal oscillator, there is a possibility that the ATMEGA32 device's clock source selection fuse is being accidentally altered to select the external clock source. If the device's clock source selection fuse gets set to external and there is no external clock source, the device will not program. To recover from this condition it is necessary to provide an external crystal temporarily in order to set the device back to the internal clock source mode.

If this is what is happening, then you will need to check the values to which your configuration fuses are being set.

If you can post a schematic diagram of your atmega32 circuit, it might be possible to spot what may be contributing to the mis-programming of your device.

hgmjr
 

hgmjr

Joined Jan 28, 2005
9,027
Thanks for the quick replies!
So, you mean that its possible for the fuses to get reset without me programming them?

Here is a schematic:
I do not know of any way that AVR fuses can reprogramm themselves. What is more likely is that something happened during a programming operation that altered the fuse setting by accident.

I could not open your schematic in the .sch format. Can you provide it in pdf format by any chance.

hgmjr
 

Thread Starter

electronics wiz

Joined Mar 15, 2007
54
What I don't understand is that if I messed up the fuses while programming then wouldn't the avr have not worked at all?

Here is a schematic in jpeg format:
 

Attachments

hgmjr

Joined Jan 28, 2005
9,027
What I don't understand is that if I messed up the fuses while programming then wouldn't the avr have not worked at all?

Here is a schematic in jpeg format:
According to your schematic, there is no pull-up resistor on the RESET line. This is definitely a must have component. Atmel recommends 10K. Try adding a 10K pullup to +5V and I suspect you will find your intermittent behavior will be gone.

hgmjr
 

Thread Starter

electronics wiz

Joined Mar 15, 2007
54
I just tried the 10k pullup, it had no effect and now the micro won't program at all no matter how many times I try.Is there any way to see if the avr is alive?

Thanks alot!
 

hgmjr

Joined Jan 28, 2005
9,027
Assuming you have not accidentally damaged the part, I strongly suspect that the problem is that your ATMEGA32 has had its clock source fuse set to external clock and you do not happen to have a crystal connected to its xtal1 and xtal2 input pins.

If you have a crystal of 1Mhz to 10 Mhz, temporarily attach it to the crystal input pins and then try to program the device.


Without the 10K resistor during earlier programming attempts it is possible that the fuse settings got changed accidentally. This should not happen if you keep a 10K pullup resistor on the RESET pin at all times.

hgmjr
 

Thread Starter

electronics wiz

Joined Mar 15, 2007
54
I found an old circuit board with one on it but it is bigger then the normal crystal so I think that its an oscillator. Will this work? Also, will I need to use load caps?
 

hgmjr

Joined Jan 28, 2005
9,027
I assume when you say bigger you mean physically larger. That should be just fine. A good range of frequencies is 1MHz to 10Mhz. And yes, you do need a couple of small valued capacitors to load the crystal. 20pfd on both crystal leads to ground is fairly common. These caps are mainly there to insure that the crystal starts oscillating under all conditions when power is initially applied to the microcontroller.

hgmjr
 

hgmjr

Joined Jan 28, 2005
9,027
Once you get the device back operating, you should not have any problems if you always make sure that you have a 10K pullup resistor on the RESET pin.

hgmjr
 

hgmjr

Joined Jan 28, 2005
9,027
Sorry to hear about the demise of the AVR. The AVR devices are pretty robust components. I damaged one once by installing it in the socket with the power pins reversed.

I would recommend you clearly label the suspect device as questionable and then acquire a replacement. Once you have successfully programmed the replacement part then you can go back and try the suspect part once again.

hgmjr
 
Top