1. electronics wiz

    Thread Starter Active Member

    Mar 15, 2007
    54
    0
    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
     
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Are you using a crystal or are you using the ATMEGA32 with the internal RC oscillator?

    hgmjr
     
  3. electronics wiz

    Thread Starter Active Member

    Mar 15, 2007
    54
    0
    I am using the 8 Mhz internal oscillator.
     
  4. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  5. electronics wiz

    Thread Starter Active Member

    Mar 15, 2007
    54
    0
    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:
     
  6. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  7. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Fuses have some default values set by the manufacturer and are stated in the datasheet of the uC.
     
  8. electronics wiz

    Thread Starter Active Member

    Mar 15, 2007
    54
    0
    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:
     
  9. Razor Concepts

    Active Member

    Oct 7, 2008
    212
    1
  10. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  11. electronics wiz

    Thread Starter Active Member

    Mar 15, 2007
    54
    0
    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!
     
  12. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  13. electronics wiz

    Thread Starter Active Member

    Mar 15, 2007
    54
    0
    Do you think its ok to pull one off an old circuit board because unfortunately I don't have one lying around?

    Thanks
     
  14. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    You can give that a try.

    hgmjr
     
  15. electronics wiz

    Thread Starter Active Member

    Mar 15, 2007
    54
    0
    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?
     
  16. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  17. electronics wiz

    Thread Starter Active Member

    Mar 15, 2007
    54
    0
    Thanks!!
    Ill try this and see what happens
     
    Last edited: Aug 3, 2009
  18. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  19. electronics wiz

    Thread Starter Active Member

    Mar 15, 2007
    54
    0
    Still nothing. I'm pretty sure my micro is dead.
     
  20. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
Loading...