I just bought a Atmega8 and burned the bootloader through the Arduino GUI. Now I try the Blink example to test if the new Atmega8 was working. I hooked the oscilloscope to pin 19 (LED_BUILTIN) and measure the time between high and low state. The time between High and low was 2000ms, not the 1000ms as I was expected. Is this a normal behavior, or it's a bad chip?
Oh well I forgot that, I modified the low fuse bit in boards.txt to set the oscillator to 8mhz internal oscillator.
You've probably forgot to change the frequency in the boards.txt file. However, if you want a better solution for running the ATmega8 with different clock frequencies, you should install MiniCore. GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
by using MiniCore and the internal oscillator, you'll gain two more IO pins
I have tried install MiniCore, config the Atmega8 to run on 8Mhz internal oscillator, but when I use the command: delay(10); the result is still the same: a delay of 20ms instead of the expected 10ms. I tried 1Mhz internal oscillator and seem that the delay is now increased 8 more times (a delay of 160ms instead of the expected 10ms). If I use a external crystal at 16mhz, the delay command works fine. Everything works fine at 8mhz, except that delay(). Please explain this more clearly.
You need to re-burn the bootloader in order to set the correct fuses. Are you uploading using a programmer, or via a USB to serial adapter?
Thanks a lot, I forgot to use the correct .hex bootloader file. After using the one designed for 8hmz operation it work well now
One more question please, the new XTAL1 and XTAL2 count as digital pin without pwm?