It looks like I've bricked my chip (ATMEGA8-16PU) by setting the WTDON fuse and flashing an empty loop as the main program.

I suspect that the chip constantly goes into reboot every ~60 ms, which is why I can no longer connect with it through the programmer (other chips work with this programmer fine). Does anyone have any ideas how it can be revived? Ihe fuses were programmed like this if I remember correctly:


I'm using USBASP v2.0 programmer for flashing. As you can see by hfuse(0x99), an ext. Crystal is selected, i'm using 8 MHz quartz, but there is no effect. To tell the truth, I didn't get a chance to check the operation of the crystal.

UPDATE So apparently I got into a situation described in link below:

CKSELx Configuring the “CKSELx” fuses to select an external clock source that is not present

Fortunately, there was attiny13 at hand in which a programmed such a code like this:

while (1)
    PORTB ^= 1 << 3;

and sent a signal from PB3 of Tiny13 to XTAL1 of my Mega8 and everything came to life, thanx!

  • \$\begingroup\$ Tell us more about your setup. What programmer are you using? What is the system clock, a crystal or the internal oscillator? lfuse=0xD9 means the chip is expecting a low-frequency crystal: fuse calc report \$\endgroup\$
    – ErikR
    Oct 16, 2022 at 14:09
  • \$\begingroup\$ Note: the hfuse setting does not select the system clock. The lfuse value selects which clock source to use. \$\endgroup\$
    – ErikR
    Oct 16, 2022 at 14:59
  • \$\begingroup\$ yes, sorry, i mean lfuse \$\endgroup\$
    – user324050
    Oct 16, 2022 at 17:26

1 Answer 1


Here is Microchip's take on unbricking an AVR:


The fuse bits discussed pertinent to the atmega8 are: SPIEN and the CKSELx bits.

If the SPIEN bit has been cleared you need to resort to high-voltage programming.

Otherwise, note the following conditions must exist for SPI programming to work:

  • the CPU must have a clock source
  • the SPI programming speed must be less than 1/4 of the system clock

It's also been observed that the SPI clock shouldn't be too slow relative to the system clock.

You can set the SPI clock speed using the -B option in avrdude -- this sets the SPI clock length in microcseconds, e.g. "-B 5" sets the SPI clock to 5 microseconds.

I would try your avrdude command line with various -B values ranging from small values to around 400, e.g. 5, 10, 50, 100, 150, ...

You may need to try this with various different clocking configurations:

  • with your 8 MHz crystal
  • with the crystal removed
  • with the crystal removed and an external clock source fed to the XTAL1 pin

The external clock source can be from the GPIO pin of another microcontroller.

Bear in mind that you really don't know what the lfuse settings are. Even if you have a crystal attached, the cpu could be getting its clock from the internal oscillator.

Also keep in mind that the SPI clock speed must be < 1/4 the system clock. For instance, if you feed a 1 MHz clock into XTAL1 the -B value must be at least 4.

If none of this works you'll need to use high-voltage programming.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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