Fuse bits reset and locked by accident

I have 3 ATmegas, 1 on an arduino, 1 on an arduino with no bootloader, and another on a custom PCB. I use the first arduino as a programmer for the other 2 deviecs.

I have been programming the ATmega328p using only C and the avr libraries. So no arduino software at all. Ive just been using C, avr-gcc, and avrdude from the command line to program everything.

I noticed just recently that my timer interrupts weren't working as I set them up and I noticed that the all my fuse bits had been changed to 0x00 so I assumed this was the issue.

I have changed the fuse bits in the past using avrdude and ran into no issues, however, this time it errors out every time I try to change them. When I changed the fuse bits in the past I never interacted with the lock fuses only lfuse, hfuse, and efuse.

I suspect the lock fuses have changed and now prevent me from changing the fuses over USB. I know that I can change them over ICSP but every since this error occured I can no longer program my other two devices using the arduino that has the bootloader. I have also tried reburning the bootloader on the second arduino but that errors out.

I have tried to erase the chips using avrdude's -e switch but with no luck. I can still program the first arduino but the timed interrupts are way off.

I am hesitant to setup the high voltage programmer since all my atmegas are TQFP which makes it a hassle to remove and add to a new circuit.

Does anyone know a way I could change the fuse bits? Or a way that I can fix my arduinos so that I can reburn the bootloader back on?

I am also very curious as to what could cause these fuses to be reset in all of my devices. I want to make sure it doesnt happen again. Could my C program have been the culprit or would this be caused by a hardware issue.

Please let me know if you have any insight. Anything would be greatly appreciated

That feature was deliberately added to provide security. You can be sure no back door was left, otherwise what would be the point?

Yes, either. If you want advice, you have to give a lot more details of those.

Here is my github repo, GitHub - anakin4747/atmega: Learning to program AVR atmega328P

The source code is in src/ and the Makefile has the commands I would use to flash devices over USB, ICSP, and flashing fuses.

I cant be sure but if it were the code causing the issue, I believe it coincided with the time I moved the code in the ISR to the main.c and had it check for a flag in a global variable called timerInterrupt. But that is just a guess.

Do a high voltage bulk erase and start over.

Am I able to do that without desoldering the chip from the arduino?

It depends on your board.

Okay I will look into how to do it without removing,
Thank you very much for your time and assistance!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.