I use this peace of code to init the wifi:
Code: Select all
nvs_flash_init();
err_t err = wifi_connection();
vTaskDelay(3000 / portTICK_PERIOD_MS);
ESP_LOGI(TAG1,"WIFI was initiated ...........\n\n");
esp_netif_get_ip_info(my_staif, &ipInfo.ip);
printf("My IPV4: " IPSTR "\n", IP2STR(&ipInfo.ip));
Code: Select all
esp_netif_init(); // TCP/IP initiation s1.1
esp_event_loop_create_default(); // event loop s1.2
my_staif = esp_netif_create_default_wifi_sta(); // WiFi station s1.3
wifi_init_config_t wifi_initiation = WIFI_INIT_CONFIG_DEFAULT();
esp_wifi_init(&wifi_initiation); // s1.4
// 2 - Wi-Fi Configuration Phase
esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, wifi_event_handler, NULL);
esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, wifi_event_handler, NULL);
wifi_config_t wifi_configuration = {
.sta = {
.ssid = "",
.password ="",
.threshold.authmode = WIFI_AUTH_WPA2_PSK,
}
};
strcpy((char*)wifi_configuration.sta.ssid,SSID);
strcpy((char*)wifi_configuration.sta.password,PASS);
esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_configuration);
esp_wifi_start();
esp_wifi_set_mode(WIFI_MODE_STA);
esp_wifi_connect();
esp_wifi_get_ps(0);
a few question:
1) It seems to me that I have more memory to be used but why this error?
2) Why if I comment the wifi connection the program works without problems?
3) Do I need to free memory after WiFi connection?
P.S: I already use menuconfig to use another partition table with more memory.
Regards
Gastón