Skip to content

EEPROM library not saving or reading bytes #1095

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

Closed
lonerzzz opened this issue Feb 10, 2018 · 3 comments
Closed

EEPROM library not saving or reading bytes #1095

lonerzzz opened this issue Feb 10, 2018 · 3 comments

Comments

@lonerzzz
Copy link
Contributor

lonerzzz commented Feb 10, 2018

Hardware:

Board: ESP-WROOM-32
Core Installation/update date: 2017/11/26
IDE name: Arduino IDE
Flash Frequency: 40Mhz
Upload Speed: 115200

Description:

We recently received a shipment of manufactured boards that use the ESP-WROOM-32 module. The packaging of this module is different from the previous ESP-WROOM-32 that we had been using during development with markings for CE and FCC certifications now present. We are able write code to this module and to write to SPIFFs using the updater tool so flash writes are possible.

However, we are unable to either read or write successfully using the EEPROM library. With both read and write, no errors are generated and the esp_partition_write call in the commit() function is returning a 0/ESP_OK response. No errors occur, but subsequent attempts to read the flash just written always read as high bits giving 0xFF bytes and 0xFFFF shorts for example.

Is there a need for a new type of module definition with different partitions for the new ESP-WROOM-32 module? Currently the "ESP32 Dev Module" is the type we have been using.

Are there changes in IDF version that may have affected this?

Unfortunately we are totally stuck without the ability to write to flash from code.

Update: Also tried Preferences and they work fine so the issue appears to be isolated to the EEPROM library or the underlying IDF library being used. As well, the SPIFFS API is also unable to retrieve saved file contents. An update to latest version of the Arduino code as of Feb 10 also failed to eliminate the problem.

@lonerzzz
Copy link
Contributor Author

Two issues were appearing at the same time, bad FLASH on some modules and a broken version of mkspiffs (me-no-dev/arduino-esp32fs-plugin#6).

@markome
Copy link

markome commented Mar 6, 2020

I have had the same problem migrating from classical Arduino to ESP32 and I solved it using two lines of code.

The first line was put into the setup() method:
1: EEPROM.begin(512); // need to add this to esp32 in order for eeprom to work. 512 was arbitrary chosen size of Flash to use.

after writing the data to the flash, (EEPROM.put(address, value);)
a call to the function which commits changes was required:
2: EEPROM.commit(); //also needs to commit in order to save cahnegs.

@ssp5zone
Copy link

To anyone who stumbles here. Giving a slight delay after begin() before you read/write anything solved my problem.

EEPROM.begin(0x20);
delay(2000); // Some delay

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

No branches or pull requests

3 participants