Preventing AVR’s EEPROM Corruption

I have been observing rhythm patterns being corrupted intermittently while I develop the firmware of the 909 clone. I first thought it is due to some bug in my firmware, but the occurrences are too random for it. I started thinking that it is some hardware problem in the processor, so looked this issue closely. I noticed that the corruptions happen only when I power cycle the processor. It’s a good clue. I searched around to know what this problem is and how to prevent it.

I found following link from Microchip. There they explain exactly what I wanted to know:

https://microchipsupport.force.com/s/article/Prevent-EEPROM-corruption

It seems that AVR’s EEPROM corruption is a well known issue that happens often during power cycling. When the power supply voltage is not high enough (i.e., brown-out), the EEPROM may not operate properly, which causes data corruption.

In order to prevent that, the AVR RESET should be active (low) while the power supply voltage is insufficient. This can be achieved easily by enabling brown-out detector (BOD) by changing corresponding fuse bit.

I then change the fuse bits as follows (BOD enabled, VOD voltage at 4.0V). After that, the rhythm pattern corruption has not been happening until now.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.