i am trying to initialize wifi in my project, i had done this earlier i had written small piece of code earlier that was working fine, but i have tried copying same code in new project and it doesnt work, the snippet of code is as below,
Code: Select all
app_main(){
//Initialize NVS
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
/** init GPIO first for default pin */
init_gpio();
#if 1
// Initialize TCP/IP network interface (should be called only once in application)
ESP_ERROR_CHECK(esp_netif_init());
#endif
// Create default event loop that running in background
ESP_ERROR_CHECK(esp_event_loop_create_default());
#if 0
tcpip_adapter_init();
ESP_ERROR_CHECK(esp_event_loop_create_default());
#endif
/*V42 onboard esp netif uses instead of tcpip_adapter*/
esp_netif_t *local_sta_netif = esp_netif_create_default_wifi_sta();
#if __WIFI_MANAGER_LVL0__
ESP_LOGI(TAG, "NETIF from sta = 0x%X", (uint32_t) local_sta_netif );
#endif
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
/*loop forever to detect error*/
for(;;)
{}
}
ESP IDF related informationD (1586) esp_netif_lwip: LwIP stack has been initialized
D (1596) esp_netif_lwip: esp-netif has been successfully initialized
D (1606) event: running task for loop 0x3ffbdbc4
D (1606) event: created task for loop 0x3ffbdbc4
D (1606) event: created event loop 0x3ffbdbc4
V (1616) esp_netif_objects: esp_netif_next_unsafe 0x0
V (1616) esp_netif_objects: esp_netif_next_unsafe 0x0
V (1626) esp_netif_objects: esp_netif_next_unsafe 0x0
D (1626) esp_netif_objects: esp_netif_add_to_list 0x3ffb8748
V (1636) esp_netif_objects: esp_netif_next_unsafe 0x0
D (1646) esp_netif_objects: esp_netif_add_to_list netif added successfully (total netifs: 1)
assertion "s_list_lock" failed: file "D:/esp_tool/v42/esp-idf/components/esp_netif/esp_netif_objects.c", line 57, function: esp_I (1656) WIFI_API: NETIF from sta = 0x3FFB8748
netif_list_unlock
abort() was called at PC 0x400d3937 on core 0
0x400d3937: __assert_func at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/assert.c:62 (discriminator 8)
Backtrace:0x4008741b:0x3ffc0980 0x40087ac5:0x3ffc09a0 0x4008e7c2:0x3ffc09c0 0x400d3937:0x3ffc0a30 0x400effbd:0x3ffc0a60 0x400f01f7:0x3ffc0a80 0x400f0c39:0x3ffc0aa0 0x400f197a:0x3ff
c0ad0 0x400d356a:0x3ffc0b00 0x400898d1:0x3ffc0be0
0x4008741b: panic_abort at D:/esp_tool/v42/esp-idf/components/esp_system/panic.c:330
0x40087ac5: esp_system_abort at D:/esp_tool/v42/esp-idf/components/esp_system/system_api.c:106
0x4008e7c2: abort at D:/esp_tool/v42/esp-idf/components/newlib/abort.c:46
0x400d3937: __assert_func at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/assert.c:62 (discriminator 8)
0x400effbd: esp_netif_list_unlock at D:/esp_tool/v42/esp-idf/components/esp_netif/esp_netif_objects.c:57 (discriminator 1)
0x400f01f7: esp_netif_get_handle_from_ifkey at D:/esp_tool/v42/esp-idf/components/esp_netif/esp_netif_objects.c:187
0x400f0c39: esp_netif_new at D:/esp_tool/v42/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:402
0x400f197a: esp_netif_create_default_wifi_sta at D:/esp_tool/v42/esp-idf/components/esp_wifi/src/wifi_default.c:322
0x400d356a: wifi_manager at D:/projects/esp32/v42/eport/v300/main/wifi_api.c:896
0x400898d1: vPortTaskWrapper at D:/esp_tool/v42/esp-idf/components/freertos/xtensa/port.c:143
i have attached SDKconfig file415) cpu_start: Project name: blink
I (420) cpu_start: App version: 1
I (424) cpu_start: Compile time: Sep 2 2022 10:31:36
I (430) cpu_start: ELF file SHA256: a5000b365733cf89...
I (436) cpu_start: ESP-IDF: v4.2.2
I (441) cpu_start: Starting app cpu, entry point is 0x400812ac
any help wrt above issue would be much appreciated ? let me know if you need any more information