Page 1 of 1

nvs flash examples

Posted: Thu Aug 24, 2017 10:26 am
by Saskia
For what do i need

Code: Select all

nvs_flash_init
?
I see an explanation here: https://esp-idf.readthedocs.io/en/v1.0/ ... flash.html
But i'm looking for a real example. I see some codes, which use this, but also work without nvs flash.

Also tcpip_adapter_init().
" * The aim of this adapter is to provide an abstract layer upon TCPIP stack.
* With this layer, switch to other TCPIP stack is possible and easy in esp-idf."
Image
So this create an abstract layer upon this stack to switch to other tcpip stacks. ....what other tcpip stacks?

Re: nvs flash examples

Posted: Thu Aug 24, 2017 10:52 am
by ESP_igrr
Saskia wrote:For what do i need nvs_flash_init?
I see some codes, which use this, but also work without nvs flash.
Currently if you use WiFi stack, it will also call nvs_flash_init internally, so the example may be able to use NVS even without a call to nvs_flash_init. Applications should not rely on this behavior though, as it is likely that this call will soon be removed from WiFi library.
The other reason why you need to call nvs_flash_init yourself is that you need to handle possible initialization errors. See how it is done in NVS example.
Saskia wrote:So this create an abstract layer upon this stack to switch to other tcpip stacks. ....what other tcpip stacks?
Currently lwip is the only stack we support inside IDF, but at some point we have been looking at supporting PicoTCP. There may be other solutions in the future.

Re: nvs flash examples

Posted: Thu Aug 24, 2017 11:06 am
by Saskia
Ok, just to be sure: when i use 'esp_wifi_init' i don't need nvs_flash_init()? And tcpip_adapter_init() is (now) not necessary?

Re: nvs flash examples

Posted: Thu Aug 24, 2017 12:44 pm
by ESP_igrr
No, both are necessary.

nvs_flash_init is necessary because you need to handle the possible error code. See nvs examples in examples/storage directory.

tcpip_adapter_init is necessary, because tcpip_adapter is used as a link between the TCP/IP stack, event handlers, DHCP client/server, WiFi driver, and Ethernet driver. You can only skip its initialization if you are using none of the above.