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
"Flash wearing behaviour"
Re: "Flash wearing behaviour"
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
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: "Flash wearing behaviour"
Is it possible to interrogate the flash to determine empirically when its contents are changed?
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: "Flash wearing behaviour"
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"
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)
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"
Only two methods are writing to flash (last two lines).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')
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?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?
Yes, setting the interface state does also call a possible flash writing method of the ESP SDK.Would something like this potentially save a write also?
if not wlan.active():
wlan.active(True)