Arduino-EEPROMEx icon indicating copy to clipboard operation
Arduino-EEPROMEx copied to clipboard

Work around problem in <avr/eeprom.h>

Open SpenceKonde opened this issue 4 years ago • 1 comments

At least as of the avr-gcc package Arduino is distributing as 7.3.0-atmel3.6.1-arduino5 (with latest megaAVR board package, 1.8.5), for megaavr parts, eeprom_is_ready() is defined as:

# define eeprom_is_ready()	bit_is_clear (NVM_STATUS, NVM_NVMBUSY_bp)

Those registers do not exist, at least on the megaAVR 0-series (ATmega4809/4808 and smaller flash versions), tinyAVR 0-series or tinyAVR 1-series parts. They meant to check the EEBUSY bit in the NVMCTRL.STATUS register. I don't know who to submit fixes for eeprom.h to, but this change works around the bug in this library, so this will work on megaavr parts (Nano Every, Uno WiFi Rev. 2, and the ATtiny parts, which are supported by https://github.com/SpenceKonde/megaTinyCore)

SpenceKonde avatar Mar 22 '20 08:03 SpenceKonde

The problem is solved, I think, when we use the standard library EEPROM.h in C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src\EEPROM.h

instead of AVR Libc EEPROM.h here: https://github.com/Patapom/Arduino/blob/master/Libraries/AVR%20Libc/avr-libc-2.0.0/include/avr/eeprom.h Where is this library located on my PC? I can’t find it.

avandalen avatar Mar 22 '20 10:03 avandalen