Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around problem in <avr/eeprom.h> #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SpenceKonde
Copy link

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)

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)
@avandalen
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants