ezieragabriel / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

WARNING: EEPROM library does not verify if eeprom is ready nor disable interrupts #1139

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The eeprom library is missing 2 important features in its read and write 
methods and because of this, software locks can happen (an example showing this 
is here http://youtu.be/_yOcKwu7mQA).  The 2 features that need to be added to 
the read and write methods are below:

1.  Check that EEPROM is ready before reading/writing (eeprom_is_ready function)
2.  Read/write operations on EEPROM should never be interrupted : we should 
always disable interrupts (nointerrupts()) before any operation and 
re-enable/set interrupts after (interrupts()).

In section 7.6.3 of the ATmega328 datasheet 'EECR – The EEPROM Control 
Register' describes these requirements and the blog post below describes these 
requirements in a more easy to understand way.
http://michael.bouvy.net/blog/en/2013/06/17/eeprom-advanced-usage-arduino-uno-at
mega328-int-char-string/

Original issue reported on code.google.com by dparson...@gmail.com on 27 Aug 2014 at 7:43