nvs flash examples

Saskia
Posts: 40
Joined: Mon Jun 26, 2017 11:45 am

nvs flash examples

Postby Saskia » Thu Aug 24, 2017 10:26 am

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?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: nvs flash examples

Postby ESP_igrr » Thu Aug 24, 2017 10:52 am

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.

Saskia
Posts: 40
Joined: Mon Jun 26, 2017 11:45 am

Re: nvs flash examples

Postby Saskia » Thu Aug 24, 2017 11:06 am

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?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: nvs flash examples

Postby ESP_igrr » Thu Aug 24, 2017 12:44 pm

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.

Who is online

Users browsing this forum: No registered users and 112 guests