WiFi connection and memory error main program

Gaston1980
Posts: 28
Joined: Sun Oct 06, 2024 10:26 am

WiFi connection and memory error main program

Postby Gaston1980 » Sun Nov 17, 2024 2:03 am

Hi to all, I tested a WiFi connection in a project with success and everything works like a charm!!! Now I'm trying to use this peace of code with a main program and memory problems came up. This is the memory map of the program.
Image

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));
which calls this other code:

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);
In my main program I use a large array to be transfer via wifi which in case of no memory will show message. And I got the messsage about memory being not enough!!!
Image
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
Attachments
nomemory.png
nomemory.png (48.26 KiB) Viewed 281 times
memory.png
memory.png (59.43 KiB) Viewed 281 times

Gaston1980
Posts: 28
Joined: Sun Oct 06, 2024 10:26 am

Re: WiFi connection and memory error main program

Postby Gaston1980 » Sun Nov 17, 2024 2:48 am

By the way ...Im using esp32 32E wroom kit to take pics with ov7670 and just to be sure...could this be related to a memory heap issue due to WiFi? using ov7670 and res 320x240 seem to be a problem with this esp32.

Who is online

Users browsing this forum: No registered users and 208 guests