I’m mostly ignorant on the subtleties of the network protocols. After reading through this discussion; reading the FAQ at the top, reading the documentation (docs.micropython.org/en/latest/esp8266/library/network.html) and:
also those on Github:
EPS8266: No automatic reconnect after WiFi activation #2493 (closed)
esp8266: modnetwork: add optional save_to_flash parameter to connect #2510 (open)
Store interface configuration to flash only where documented and implement
esp.save_config() to save configuration to flash on demand #2564 (open)
And referring to the Hardware-API:
https://github.com/micropython/micropyt ... wlan-class
I’m still confused.
Here is my summary of the issue -please correct my understanding!
1) The Micropython Network module used in the ESP8266 port is based on the "ESP Open SDK"
(
https://github.com/pfalcon/esp-open-sdk), which is a mixture of open source and closed binary blobs from Espressif
2) On first network access, the default mode of the ESP SDK:
Stores the WiFi credentials (SSID, password) in a reserved portion of flash. In this case, every call to either
WLAN.connect()
or
WLAN.active()
writes this information to flash.
3) There is now an option to never store this information to flash (the ‘_current’ variant). This requires putting the WiFi credentials in a Python script that runs before every communication session.
4) There does not seem to be an option in the ESP SDK that allows reading WiFi credentials stored in reserved flash without also writing them.
Hence the choice between a) keeping the calls to the Micropython Network module as they are and causing flash wear, or b) changing the module calls and breaking current documentation and user scripts.
I’m not sure why this limitation exists in the ESP SDK -‘read disturb’ errors are presumably monitored by the flash controller. Perhaps this implies that Espressif stores the state of the current connection in flash rather than in a register or RAM.
****
There is a separate issue from this, and that is whether WiFi credentials should be stored anywhere in flash, whether in the ESP reserved portion or in the user’s script.
What am I missing?