# Bricked ATMEGA328PB by setting low fuse to 0xF5 - How to recover?

While programming an ATMEGA328PB via ISP, I wanted to set the efuse to 0xF5. By accident, I didn't write the efuse but the lfuse instead.

Since then, I cannot communicate with the chip via ISP anymore.

I am not entirely sure which mode the IC is in right now. Pg. 47 of the manual suggests to me that it is in Low Frequency Crystal Oscillator Mode.

I did desolder the 3-pin 16MHz resonator that was used previously and connected my function generator set to 32.768Hz in squarewave mode with 5Vpp and 2.5V offset to the XTAL1 pin. (XTAL2 is floating now that I've desoldered the resonator). I've also connected the generators gnd to my pcbs gnd. Then I've tried to connect to the chip with avrdude set to 500Hz Baudrate. (-B 500Hz). Unfortunately, avrdude still cannot connect to the chip over ISP.

I've also tried the same procedure with 16MHz squarewave in case the IC is in Ext. clock mode to no avail. I've also verified with my oscilloscope that the function generators signal is indeed what it's supposed to be.

Is there anything I'm doing incorrectly here? How can I unbrick the IC?

Precaution: Using HVSP or HVPP is not an option because I lack a programmer for that.

• How much is your time worth compared to the cost of a replacement ATMega328 chip? Can you just buy a new chip (and a few spares while you're at it)? – tangrs Feb 23 '19 at 13:29
• You can DIY a high voltage programmer if you like. Just use google. – Long Pham Feb 23 '19 at 13:31
• @tangrs Well I'd really like to learn how to fix this and not throw away a perfectly good chip. Also, it's going to take atleast a few days to get a replacement delivered while I could probably fix the chip myself this weekend :) – Zulakis Feb 23 '19 at 13:36

Bricking a chip is never fun. If you really want to learn how to fix it, you certainly can, but it is usually not time efficient or cost effective unless you really want to learn.

## Diagnosing the Problem

For reference, here is the datasheet for the ATmega328pb. The parts on clock source selection are in section 11, and the parts on self programming and fuse bits are in section 32. Also of great reference is this fuse calculator, which doesn't have the 328pb, but the 328p has the same fuses.

If all other fuses are default, low fuse of 0xF5 means the device is in external clock mode with a startup time of 6CK and additional delay of 19CK after reset. The external clock must be extremely accurate. See datasheet section 11.7 for more details. However, the serial programming and reset are still enabled, so if you connect a stable clock from a source as shown in figure 11-3, communications is still possible. The clock must be on and stable BEFORE the MCU powers up.

If your programmer still cannot talk, there is likely something else wrong. Are you positive you set the LFUSE and not the HFUSE? 0xF5 on the HFUSE would completely disable normal serial programming. Have you verified the frequency of your clock signal? Is it at the correct voltage for your MCU? Are you sure there is a common ground between them?

## Other Thoughts

I developed an ATtiny High-Voltage Serial programmer a long while ago to fix these types of issues, but that won't help with the mega328, which would need a High-Voltage Parallel Programmer to reset the chip. I think a lot of the principals are the same if you are just interested in learning.