1

I have build simple Arduino ISP programmer, which works fine on ATmega 328 chips (when I select Arduino UNO board) and a ton of others (tiny45, tiny2313). But, when I want to program an ATmega8 chip, it writes it succesfuly, but then the chip runs at 1/16 of the desired speed! (for example a delay(1000) in code takes 16 seconds real-life). I have a 16 MHz crystal oscillator with capacitors connected to the chip, so I thought that the problem is not there but... when I remove the crystal, the chip still runs the same, it still takes 16 seconds. So I assume two possibilities:

  1. the crystal is somehow broken, so the chip runs from some internal thing? But I tried multiple crystals, all the same,

OR

  1. I am doing something wrong, but I really don't know what...

Does somebody have an idea what may be wrong or how to test it? Or feel free for more details...Thanks

EDIT: In IDE, I am selecting "Arduino NG or older" and then I select ATmega8 as processor. I am uploading the sketches directly, without bootloader.

  • 1
    This sounds like a problem with the fuse bit configuration - specifically, that you are running with an internal oscillator and with a divider configuration that gives you a 1 MHz clock rate. – Chris Stratton Nov 22 '15 at 18:35
  • Second the fuse bits. Try selecting burn bootloader in the arduino menu, as that should set the correct fuses. – Gerben Nov 22 '15 at 20:06
  • I checked it, and in boards.txt, my fuses are set to 0xDF (low) and 0xCA, which, according to this (engbedded.com/fusecalc) should set to external crystal. I even tried to change low to 0x4C, which should run it at 8MHz internally, but it had no effect... – user72028 Nov 22 '15 at 20:10
  • Gerben: Avrdude returns: "efuse" memory type not defined for part "ATmega8"... I dont know what an efuse is... – user72028 Nov 22 '15 at 20:11
1

Ok, I finally solved it, so I will write it here so somebody may learn from it in the future :) The problem was really in the fuses, thanks Chris Stratton. Most of my chips were bought already modified for working with Arduino. But this ATmega 8 had the factory fuses, which were setting it for working with internal 1MHz oscillator. You can read and your write your fuse settings with avrdude, so I set them to arduino default (lfuse 0xDF, hfuse 0xCA, from boards.txt). Now it works perfectly even without uploading bootloader.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.