Electronic – AVR unable to enter programming mode

avrcrystalfuse-bitsmicrocontrolleroscillator

I have an ATMega88PB on a PCB which won't enter programming mode after changing the fuse settings to EXTFSXTAL_16KCK_14CK_0MS. Prior to this, the AVRISP MkII was able to communicate with the microcontroller (I've since switched to an Atmel ICE which still isn't able to communicate).
Atmel Studio error

In case there are any doubts that I have changed other fuse settings incorrectly, here is a screenshot of the fuses prior to programming.
Fuse settings

I find this confusing because the oscillator appears to be running fine – if I had programmed the incorrect fuse setting (e.g. ext clk) then I would expect the oscillator to be disabled to save power. As you can see this isn't the case, with the oscillator running just slightly under 20MHz.

XTAL2 waveform:
XTAL2 Waveform

XTAL1 waveform:
XTAL1 Waveform

Here is the schematic for the oscillator circuit:
Schematic

I've tried programming the device at every available speed and still haven't had any luck. I also tried feeding in a clock signal from a working AVR's CLK0 pin unsuccessfully, and have tried 18pF load capacitors in place of the 33pF indicated in the schematic.

What else can I try to get this microcontroller running again?

Best Answer

Your low fuse register is 0xD7. That equals 0b1101 0111 in binary.

Looking at the data sheet the lower 4 bits are responsible for the clock. This correlates to

CKSEL3 = 0, CKSEL2 = 1, CKSEL1 = 1, CKSEL0 = 1.

From the data sheet this is not a valid setting, but it may be set to a low frequency crystal. The two similar valid settings are 0b0100 and 0b0101, they are both for a low frequency oscillator. Try replacing the 20MHz crystal with a 32.768kHz crystal.

An expected frequency and actual frequency mismatch may result in the processor not starting.

If that does not work, you may have to use parallel programming to recover the chip. Parallel programming does not require a working crystal and provides a clock externally.

Here is a screen capture of the data sheet. enter image description here