Page 1 of 1

nvs_flash_init: why present in the template code and some other examples?

Posted: Wed Oct 11, 2017 1:16 am
by samsam
I tried removing/comment out nvs_flash_init() in the template example and smart_config example and it doesn't matter if present in the code or not - the log (in debug level) always shows that nvs is initialising and bunch of other nvs initializations going on, doesnt matter if nvs_flash_init() exist in code or not!

Can somebody from Espressif explain what is the story?

Thanks

This is from smart_config log with nvs_flash_init() removed in app_main():

I (240) cpu_start: Starting scheduler on APP CPU.
D (240) heap_init: New heap initialised at 0x3ffe0440
D (240) heap_init: New heap initialised at 0x3ffe4350
D (250) nvs: nvs_flash_init_custom start=9 count=6
D (280) nvs: nvs_open misc 1
D (280) nvs: nvs_get_str_or_blob log
I (280) wifi: wifi firmware version: b39ed32
I (280) wifi: config NVS flash: enabled
I (280) wifi: config nano formating: disabled
I (290) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (300) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
D (310) nvs: nvs_open nvs.net80211 1
D (310) nvs: nvs_get opmode 1
D (310) nvs: nvs_get country 1
D (320) nvs: nvs_get_str_or_blob sta.ssid
D (320) nvs: nvs_get_str_or_blob sta.mac
D (320) nvs: nvs_get sta.authmode 1
D (330) nvs: nvs_get_str_or_blob sta.pswd
D (330) nvs: nvs_get_str_or_blob sta.pmk
D (340) nvs: nvs_get sta.chan 1
D (340) nvs: nvs_get auto.conn 1
D (340) nvs: nvs_get bssid.set 1
D (350) nvs: nvs_get_str_or_blob sta.bssid
D (350) nvs: nvs_get sta.phym 1
D (350) nvs: nvs_get sta.phybw 1
D (360) nvs: nvs_get_str_or_blob sta.apsw
D (360) nvs: nvs_get_str_or_blob sta.apinfo
D (370) nvs: nvs_get_str_or_blob ap.ssid
D (370) nvs: nvs_get_str_or_blob ap.mac
D (370) nvs: nvs_get_str_or_blob ap.passwd
D (380) nvs: nvs_get_str_or_blob ap.pmk
D (380) nvs: nvs_get ap.chan 1
D (380) nvs: nvs_get ap.authmode 1
D (390) nvs: nvs_get ap.hidden 1
D (390) nvs: nvs_get ap.max.conn 1
D (390) nvs: nvs_get bcn.interval 2
D (400) nvs: nvs_get ap.phym 1
D (400) nvs: nvs_get ap.phybw 1
D (400) nvs: nvs_get ap.sndchan 1
D (410) nvs: nvs_set_blob sta.mac 6
D (410) nvs: nvs_set_blob ap.mac 6
I (420) wifi: Init dynamic tx buffer num: 32
I (420) wifi: Init data frame dynamic rx buffer num: 32
I (420) wifi: Init management frame dynamic rx buffer num: 32
I (430) wifi: wifi driver task: 3ffaf33c, prio:23, stack:4096
I (430) wifi: Init static rx buffer num: 10
I (440) wifi: Init dynamic rx buffer num: 32
I (440) wifi: Init rx ampdu len mblock:7
I (450) wifi: Init lldesc rx ampdu entry mblock:4
I (450) wifi: wifi power manager task: 0x3ffc3368 prio: 21 stack: 2560
I (460) wifi: wifi timer task: 3ffc43c0, prio:22, stack:3584
D (460) nvs: nvs_open phy 0
D (460) nvs: nvs_get cal_version 4
D (470) nvs: nvs_get_str_or_blob cal_mac
D (470) nvs: nvs_get_str_or_blob cal_data
D (480) nvs: nvs_close 3
I (500) phy: phy_version: 357.0, a6bf95b, Jul 25 2017, 12:28:06, 0, 0
I (500) wifi: Init Ampdu: 1 tx baw=6 rx baw=6
I (500) wifi: mode : sta (24:0a:c4:06:f4:98)

Re: nvs_flash_init: why present in the template code and some other examples?

Posted: Wed Oct 11, 2017 2:00 am
by ESP_Sprite
From memory, WiFi/BT at the moment call nvs_flash_init in their initialization procedure. This is not good architecture and we want to take this out, but at the moment it's still there.