Page 1 of 1

"Flash wearing behaviour"

Posted: Thu Nov 17, 2016 8:41 am
by warren
It would be really useful to have a definitive list of uPy commands which cause values to be saved in flash to as to persist reboots...

Obviously we have recently been made aware of the 'network' methods..

Others?

Thanks

Re: "Flash wearing behaviour"

Posted: Thu Nov 17, 2016 11:03 pm
by kfricke
I didi just check the ESP SDK and tried to find all methods giving a hint to write into flash. After looking up their occurrence in the sources of the MicroPython ESP8266 port, these are still my only findings:
  • network.WLAN(network.SOFTAP_IF | network.STATION_IF).active(<True | False>)
  • network.WLAN(network.SOFTAP_IF | network.STATION_IF).config(param=value)
  • network.WLAN(network.STATION_IF).connect(n_args > 1)
  • modules/flashbdev.py
Maybe other settings which are used for deep sleep are written to flash, but this can not be checked in the sources, as this part is closed source. Test scenarios might help guessing further (e.g. check for remaining deep sleep settings after cold-start).

Re: "Flash wearing behaviour"

Posted: Fri Nov 18, 2016 7:26 am
by pythoncoder
Is it possible to interrogate the flash to determine empirically when its contents are changed?

Re: "Flash wearing behaviour"

Posted: Fri Nov 18, 2016 8:45 am
by kfricke
You could capture the SPI communication to the SPI flash chip using a logic analyzer. I do only own a cheap logic analyzers (logic pirate) which is sadly missing compression and streaming via USB (hoping for Xmas ;) ). So maybe someone else can capture a to be defined test session no the ESP?

Re: "Flash wearing behaviour"

Posted: Mon Nov 21, 2016 3:21 pm
by BobRyan
Does this mean the example doConnect() function performs three writes on each execution?
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('ssid', 'password')

If so I'm impressed that some of my devices are still operating properly as I've got a small sensor network which calls this every 5 minutes. Is there a way to test if the chip has the ssid/password stored? Would something like this potentially save a write also?
if not wlan.active():
wlan.active(True)

Re: "Flash wearing behaviour"

Posted: Mon Nov 21, 2016 7:35 pm
by kfricke
BobRyan wrote:Does this mean the example doConnect() function performs three writes on each execution?
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('ssid', 'password')
Only two methods are writing to flash (last two lines).
If so I'm impressed that some of my devices are still operating properly as I've got a small sensor network which calls this every 5 minutes. Is there a way to test if the chip has the ssid/password stored?
I can not yet watch the SPI bus to the flash chip to check this live. Could someone with a better logic analyzer check this?
Would something like this potentially save a write also?
if not wlan.active():
wlan.active(True)
Yes, setting the interface state does also call a possible flash writing method of the ESP SDK.