How to reset all interrupt registers to Factory Settings in Arduino Mega 2560

pylon:
The interrupt registers are reset every time you restart your Mega by either powering it up or hitting the reset button.

So if your problem still exists after a power cycle, it's not the interrupt register but some program code. I never heard that changing the EEPROM memory changed any code storage cells so I guess that the reason is somewhere else.

I doubt that fuse settings are the problem but you may have changed some flash memory cells where the bootloader is stored. If you have an ICSP programmer (an Arduino with the ICSP sketch and a few wires may fit too) you can reburn the bootloader with your IDE. That writes the bootloader code and sets the fuses correctly. After that you should have the Mega in a factory reset state (there is a tiny probability that you changed the firmware of the co-processor ATmega16U2 which does the USB to serial conversion on-board the Mega but we ignore that for the moment).

Thank you Pylon. This solved the issue. I reburned the Bootloader. It was probably that EEPROM overflow led to some how corruption of the Bootloader. It was not fuses which I suspected. (I still do not know how but it works :slight_smile: ) Now all the Megas are working fine.

And I apologize to all for not posting the code but the reason is that code is almost 30k lines with more than 34 sub sections. It was impossible to post all of that here and I am safe to presume that no body has time to examine the cross references in the code.

But I am glad I came here.

Thank you everyone.
Best regards
Anuj Garg