Skip to content

Fixed Persistent Storage Issue for RP2040 with Arduino Pico Framework#868

Merged
jgromes merged 1 commit intojgromes:masterfrom
nmaas87:nmaas87-eeprom-rp2040-patch
Nov 4, 2023
Merged

Fixed Persistent Storage Issue for RP2040 with Arduino Pico Framework#868
jgromes merged 1 commit intojgromes:masterfrom
nmaas87:nmaas87-eeprom-rp2040-patch

Conversation

@nmaas87
Copy link
Copy Markdown
Contributor

@nmaas87 nmaas87 commented Nov 4, 2023

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

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
@jgromes
Copy link
Copy Markdown
Owner

jgromes commented Nov 4, 2023

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.

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

Successfully merging this pull request may close these issues.

2 participants