-
Notifications
You must be signed in to change notification settings - Fork 1k
Erasing EEPROM taking over 30 seconds #547
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
Comments
Hi @mayurharge For reference, you should use EEPROM buffered access: Here example: |
Sorry for incomplete details, here is specific info
|
Thanks for info. As mentioned in #302 by @hasenbanck
This means with your code, a loop of 1024, will erase and write 1024 times the 1kb flash page. To avoid this @hasenbanck provides a way to work on buffered EEPROM and when need write only once: // Clear the EEPROM buffer
for (uint16_t i = 0; i < EEPROM.length(); i++) {
eeprom_buffered_write_byte(i, 0);
}
// Copy the data from the buffer to the flash
eeprom_buffer_flush(); In this case this takes only 30ms to clear the flash. |
Thanks for the suggestion, implemented the same in my code. |
I have an EEPROM reset function where I erase EEPROM completely.
the function is something like this.
here EEPROM Size is 1024
{ DBG("erasing EEPROM.");
unsigned long start = millis();
for (unsigned int i = 0; i < EEPROM_SIZE; i++)
{
EEPROM.write(i, 0x00);
IWatchdog.reload();
}
DBG("Time took : ", millis() - start);
DBG("Erased eeprom");
// NVIC_SystemReset();
}
to execute this function it's taking more than 30 seconds.
please look into this.
The text was updated successfully, but these errors were encountered: