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