"Flash wearing behaviour"

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
warren
Posts: 73
Joined: Tue Jul 12, 2016 5:47 pm

"Flash wearing behaviour"

Post by warren » Thu Nov 17, 2016 8:41 am

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

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: "Flash wearing behaviour"

Post by kfricke » Thu Nov 17, 2016 11:03 pm

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).

User avatar
pythoncoder
Posts: 4151
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: "Flash wearing behaviour"

Post by pythoncoder » Fri Nov 18, 2016 7:26 am

Is it possible to interrogate the flash to determine empirically when its contents are changed?
Peter Hinch

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: "Flash wearing behaviour"

Post by kfricke » Fri Nov 18, 2016 8:45 am

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?

BobRyan
Posts: 3
Joined: Sun Nov 06, 2016 9:36 pm

Re: "Flash wearing behaviour"

Post by BobRyan » Mon Nov 21, 2016 3:21 pm

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)

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: "Flash wearing behaviour"

Post by kfricke » Mon Nov 21, 2016 7:35 pm

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.

Post Reply