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

EEPROM read before write? #1923

Closed
EternityForest opened this issue Mar 11, 2014 · 2 comments
Closed

EEPROM read before write? #1923

EternityForest opened this issue Mar 11, 2014 · 2 comments
Labels
Type: Duplicate Another item already exists for this topic

Comments

@EternityForest
Copy link

I took a look at the EEPROM code and at avr-libc but I did not find anything that looked like a pre-write value check. I have heard a number of developers prefer to read the eeprom to ensure that it isn't already the value you want to write to it before writing, to save write cycles.

Is the lack of this check intentional to avoid bloat? There isn't very many applications where it would be useful, but there are some cases where it might be useful, as a protection to novice programmers, and in cases where values are mostly the same the speedup would be huge.

It might also come up in the eeprom clear sketch, if someone accidentally left it programmed in, several erase cycles could be wasted for no good reason. Maybe at the very least the eeprom clear sketch should be changed to include a check?

@matthijskooijman
Copy link
Collaborator

Hey Daniel,

I took a look at the EEPROM code and at avr-libc but I did not find
anything that looked like a pre-write value check. I have heard a
number of developers prefer to read the eeprom to ensure that it isn't
already the value you want to write to it before writing, to save
write cycles.
I think recent versions of avr-libc have "update" functions in addition
to "write" functions that only do an erase+write if the value actually
changed.

See also #1459

Gr.

Matthijs

@cmaglie
Copy link
Member

cmaglie commented Mar 16, 2014

Closing as duplicate of #1459

@cmaglie cmaglie closed this as completed Mar 16, 2014
@per1234 per1234 added the Type: Duplicate Another item already exists for this topic label Jul 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Duplicate Another item already exists for this topic
Projects
None yet
Development

No branches or pull requests

4 participants