Fixed Persistent Storage Issue for RP2040 with Arduino Pico Framework#868
Merged
jgromes merged 1 commit intojgromes:masterfrom Nov 4, 2023
Merged
Conversation
RP2040 does not have an EEPROM but always uses the last 4K chunk of the flash for a software EEPROM - if used. It is exactly handled as ESP32 "SoftEEPROMs", meaning it does copy the "flashEEPROM" to memory on .begin(); and does need to commit(); to write it back. We saw in the past that a node could successfully get an OTAA on an RP2040, but could never join - due to the missing commit and wrong init, this was the reason. As the "SoftEEPROM" is always written at the end of the flash, it also survives an Arduino Sketch reflash if not wiped afterwards by node.wipe(); More info and documentation here: https://arduino-pico.readthedocs.io/en/latest/eeprom.html
This was referenced Nov 4, 2023
Owner
|
Good job on figuring it out, and thank you very much for this contribution! Merging before the big LoRaWAN PR because this is pretty self-contained. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RP2040 does not have an EEPROM but always reserves the last 4K chunk of the flash for a software EEPROM - given the Arduino Pico framework is in use. It is exactly handled as ESP32 "SoftEEPROMs", meaning it does copy the "flashEEPROM" to memory on .begin(); and does need to .commit(); to write it back. We saw in the past that a node could successfully get an OTAA on a RP2040, but could never re-join - due to the missing commit and wrong init - which is with that fixed. As the "SoftEEPROM" is always written at the end of the flash, it also survives an Arduino Sketch reflash if not wiped afterwards by node.wipe(); More info and documentation here: https://arduino-pico.readthedocs.io/en/latest/eeprom.html