espressif / ESP8266_RTOS_SDK

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
http://bbs.espressif.com
Apache License 2.0
3.31k stars 1.57k forks source link

wifi stops working 15 minutes after the start of the program (GIT8266O-418) #848

Open kormilicinkostia opened 4 years ago

kormilicinkostia commented 4 years ago

Problem Description

I am using Esp8266 in WIFI_MODE_APSTA mode. My device successfully connects to the selected network and creates an access point. After 15-20 minutes, I see that the module turns off Wi-Fi (the access point I created is lost, and esp8266 disconnects from the selected Wi-Fi station). In the logs, I see the following message:

D (1774806) tcpip_adapter: if0 dhcpc cb
D (1774809) tcpip_adapter: if0 start ip lost tmr: enter
D (1774813) tcpip_adapter: if0 start ip lost tmr: interval=120
D (1774818) tcpip_adapter: if0 start ip lost tmr: enter
D (1774823) tcpip_adapter: if0 start ip lost tmr: already started
D (1774913) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1774923) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

After that, the message in an endless loop displays the following text:

D (1774806) tcpip_adapter: if0 dhcpc cb
D (1774809) tcpip_adapter: if0 start ip lost tmr: enter
D (1774813) tcpip_adapter: if0 start ip lost tmr: interval=120
D (1774818) tcpip_adapter: if0 start ip lost tmr: enter
D (1774823) tcpip_adapter: if0 start ip lost tmr: already started
D (1774913) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1774923) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1774932) WIFI: connect to the AP fail
D (1774935) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

You can restore normal system behavior only by rebooting the power board

Expected Behavior

I want esp8266 to work stably in WIFI_MODE_APSTA mode

Actual Behavior

Turn off the wi-fi module 15-20 minutes after the start of work

Steps to repropduce

1) Turn on the wifi module in WIFI_MODE_APSTA mode 2) Connect wi-fi to the selected network 3) Wait 15-20 minutes

Code to reproduce this issue

static void event_handler(void* arg, esp_event_base_t event_base,
                          int32_t event_id, void* event_data)
{
    if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START)
    {
        ESP_LOGI(TAG, "SYSTEM_EVENT_STA_START");
        esp_wifi_connect();
    }
    else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED)
    {
        ip_addres[0]='\0';
        esp_wifi_connect();
        ESP_LOGE(TAG,"connect to the AP fail");
    }
    else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP)
    {
        ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
        ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
        sprintf(ip_addres, "%s", ip4addr_ntoa(&event->ip_info.ip));
    }else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_STACONNECTED)
    {
        wifi_event_ap_staconnected_t *event = (wifi_event_ap_staconnected_t *) event_data;
        ESP_LOGI(TAG, "station "
        MACSTR
        " join, AID=%d",
                MAC2STR(event->mac), event->aid);
    } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_STADISCONNECTED) {
        wifi_event_ap_stadisconnected_t *event = (wifi_event_ap_stadisconnected_t *) event_data;
        ESP_LOGI(TAG, "station "
        MACSTR
        " leave, AID=%d",
                MAC2STR(event->mac), event->aid);
    }
}

void start_wifi()
{

    ESP_ERROR_CHECK(esp_netif_init());
    ESP_ERROR_CHECK(esp_event_loop_create_default());

    ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
    ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL))

    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK(esp_wifi_init(&cfg));
    esp_wifi_set_ps(WIFI_PS_NONE);
    ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
    int size;
    struct_wifi_set wifi_set = job_file_wifi_set(NULL,NULL,NULL,NULL);

    memcpy(wifi_config_ap.ap.ssid,wifi_set.ssid_ap,sizeof(wifi_set.ssid_ap));
    memcpy(wifi_config_ap.ap.password,wifi_set.password_ap,sizeof(wifi_set.password_ap));
    if (strlen(&wifi_config_ap.ap.password) == 0) {
        wifi_config_ap.ap.authmode = WIFI_AUTH_OPEN;
    }

    memcpy(wifi_config_sta.sta.ssid,wifi_set.ssid_sta,sizeof(wifi_set.ssid_sta));
    memcpy(wifi_config_sta.sta.password,wifi_set.password_sta,sizeof(wifi_set.password_sta));
    //memcpy(wifi_config_sta.sta.ssid,EXAMPLE_WIFI_SSID,sizeof(EXAMPLE_WIFI_SSID));
    // memcpy(wifi_config_sta.sta.password,EXAMPLE_WIFI_PASS,sizeof(EXAMPLE_WIFI_PASS));

    ESP_LOGI(TAG, "wifi_init_softap finished.SSID:%s password:%s",
             wifi_config_sta.sta.ssid, wifi_config_sta.sta.password);

    ESP_LOGI(TAG, "wifi_init_sta finished.");
    ESP_LOGI(TAG, "connect to ap SSID:%s password:%s",
             wifi_config_ap.ap.ssid, wifi_config_ap.ap.password);

    ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA));
    ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config_ap));
    ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config_sta));
    ESP_ERROR_CHECK(esp_wifi_start());

}

// If your code is longer than 30 lines, GIST is preferred.

Debug Logs

D (145504) tcpip_adapter: if0 dhcpc cb
D (145507) tcpip_adapter: if0 start ip lost tmr: enter
D (145511) tcpip_adapter: if0 start ip lost tmr: already started
D (145516) tcpip_adapter: if0 start ip lost tmr: enter
D (145520) tcpip_adapter: if0 start ip lost tmr: already started
D (145575) httpd_sess: httpd_sess_process: httpd_req_delete
D (145581) httpd_sess: httpd_sess_process: success
D (145585) httpd: httpd_server: doing select maxfd+1 = 60
I (147173) wifi: state: 0 -> 2 (b0)
I (147184) wifi: state: 2 -> 3 (0)
I (147247) wifi: state: 3 -> 5 (10)
D (148268) system_event: SYSTEM_EVENT_STA_CONNECTED, ssid:dreamkas8, ssid_len:9, bssid:c4:a8:1d:d5:da:7c, channel:2, authmode:2
D (148278) event: running post WIFI_EVENT:4 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

D (148287) event: running post WIFI_EVENT:4 with handler 0x40262574 on loop 0x40107fa0
0x40262574: handle_sta_connected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:86

D (148293) tcpip_adapter: dhcp client init ip/mask/gw to all-0
D (148298) tcpip_adapter: if0 start ip lost tmr: enter
D (148303) tcpip_adapter: if0 start ip lost tmr: already started
D (148314) tcpip_adapter: dhcp client start successfully
D (148808) tcpip_adapter: dhcpc time(ms): 0

D (149189) tcpip_adapter: if0 dhcpc cb
D (149192) tcpip_adapter: if0 ip changed=1
D (149196) system_event: SYSTEM_EVENT_STA_GOT_IP, ip:192.168.0.69, mask:255.255.255.0, gw:192.168.0.1
D (149204) event: running post IP_EVENT:0 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

I (149211) WIFI: got ip:192.168.0.69
D (149215) event: running post IP_EVENT:0 with handler 0x40262450 on loop 0x40107fa0
0x40262450: handle_sta_got_ip at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:44

I (149221) tcpip_adapter: sta ip: 192.168.0.69, mask: 255.255.255.0, gw: 192.168.0.1
D (149308) tcpip_adapter: if0 dhcpc cb
D (149311) tcpip_adapter: if120 ip unchanged
D (149314) tcpip_adapter: ip:192.168.0.69,mask:255.255.255.0,gw:192.168.0.1

D (160681) httpd: httpd_server: processing socket 57
D (160689) httpd_sess: httpd_sess_process: httpd_req_new
D (160700) httpd_txrx: httpd_recv_with_opt: requested length = 128
D (160707) httpd_txrx: httpd_recv_with_opt: received length = 0
D (160718) httpd_parse: read_block: connection closed
D (160723) httpd: httpd_server: closing socket 57
D (160730) httpd_sess: httpd_sess_delete: fd = 57
D (160737) httpd: httpd_server: processing socket 58
D (160741) httpd_sess: httpd_sess_process: httpd_req_new
D (160745) httpd_txrx: httpd_recv_with_opt: requested length = 128
D (160752) httpd_txrx: httpd_recv_with_opt: received length = 0
D (160757) httpd_parse: read_block: connection closed
D (160761) httpd: httpd_server: closing socket 58
D (160768) httpd_sess: httpd_sess_delete: fd = 58
D (160772) httpd: httpd_server: doing select maxfd+1 = 60
D (171204) system_event: SYSTEM_EVENT_AP_STADISCONNECTED, mac:56:1d:3d:29:ce:7e, aid:1
D (171212) event: running post WIFI_EVENT:14 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

I (171219) WIFI: station 56:1d:3d:29:ce:7e leave, AID=1
D (207947) tcpip_adapter: if0 ip lost tmr: enter
D (207951) tcpip_adapter: if0 ip lost tmr: no need raise ip lost event
D (1417014) system_event: SYSTEM_EVENT_AP_STACONNECTED, mac:56:1d:3d:29:ce:7e, aid:1
D (1417023) event: running post WIFI_EVENT:13 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

I (1417031) WIFI: station 56:1d:3d:29:ce:7e join, AID=1
I (1418538) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2
D (1418544) system_event: SYSTEM_EVENT_AP_STAIPASSIGNED
D (1418548) event: no handlers have been registered for event IP_EVENT:2 posted to loop 0x40107fa0
D (1425417) system_event: SYSTEM_EVENT_AP_STADISCONNECTED, mac:56:1d:3d:29:ce:7e, aid:1
D (1425424) event: running post WIFI_EVENT:14 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

I (1425432) WIFI: station 56:1d:3d:29:ce:7e leave, AID=1
I (1772162) wifi: bcn_timout,ap_probe_send_start
I (1774667) wifi: ap_probe_send_over, rest wifi status to disassoc
I (1774672) wifi: state: 5 -> 0 (100)
D (1774774) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:c4:a8:1d:d5:da:7c, reason:200 (beacon timeout)
D (1774785) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1774793) WIFI: connect to the AP fail
D (1774798) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1774806) tcpip_adapter: if0 dhcpc cb
D (1774809) tcpip_adapter: if0 start ip lost tmr: enter
D (1774813) tcpip_adapter: if0 start ip lost tmr: interval=120
D (1774818) tcpip_adapter: if0 start ip lost tmr: enter
D (1774823) tcpip_adapter: if0 start ip lost tmr: already started
D (1774913) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1774923) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1774932) WIFI: connect to the AP fail
D (1774935) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1774942) tcpip_adapter: if0 start ip lost tmr: enter
D (1774947) tcpip_adapter: if0 start ip lost tmr: already started
D (1777794) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1777799) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1777808) WIFI: connect to the AP fail
D (1777811) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1777818) tcpip_adapter: if0 start ip lost tmr: enter
D (1777823) tcpip_adapter: if0 start ip lost tmr: already started
D (1780670) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1780676) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1780685) WIFI: connect to the AP fail
D (1780688) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1780695) tcpip_adapter: if0 start ip lost tmr: enter
D (1780700) tcpip_adapter: if0 start ip lost tmr: already started
D (1783546) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1783552) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1783561) WIFI: connect to the AP fail
D (1783564) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1783571) tcpip_adapter: if0 start ip lost tmr: enter
D (1783576) tcpip_adapter: if0 start ip lost tmr: already started
D (1786422) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1786427) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1786436) WIFI: connect to the AP fail
D (1786439) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1786446) tcpip_adapter: if0 start ip lost tmr: enter
D (1786451) tcpip_adapter: if0 start ip lost tmr: already started
D (1789298) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1789303) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1789312) WIFI: connect to the AP fail
D (1789315) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1789322) tcpip_adapter: if0 start ip lost tmr: enter
D (1789327) tcpip_adapter: if0 start ip lost tmr: already started
D (1792175) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1792180) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1792189) WIFI: connect to the AP fail
D (1792193) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1792200) tcpip_adapter: if0 start ip lost tmr: enter
D (1792205) tcpip_adapter: if0 start ip lost tmr: already started
D (1795051) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1795056) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1795065) WIFI: connect to the AP fail
D (1795069) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1795076) tcpip_adapter: if0 start ip lost tmr: enter
D (1795081) tcpip_adapter: if0 start ip lost tmr: already started
D (1797927) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1797932) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1797941) WIFI: connect to the AP fail
D (1797944) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1797951) tcpip_adapter: if0 start ip lost tmr: enter
D (1797956) tcpip_adapter: if0 start ip lost tmr: already started
D (1800803) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1800808) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1800817) WIFI: connect to the AP fail
D (1800820) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1800828) tcpip_adapter: if0 start ip lost tmr: enter
D (1800832) tcpip_adapter: if0 start ip lost tmr: already started
D (1803679) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1803684) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1803693) WIFI: connect to the AP fail
D (1803697) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1803703) tcpip_adapter: if0 start ip lost tmr: enter
D (1803708) tcpip_adapter: if0 start ip lost tmr: already started
D (1806556) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1806562) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1806570) WIFI: connect to the AP fail
D (1806574) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1806581) tcpip_adapter: if0 start ip lost tmr: enter
D (1806585) tcpip_adapter: if0 start ip lost tmr: already started
D (1809432) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1809437) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1809446) WIFI: connect to the AP fail
D (1809450) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1809457) tcpip_adapter: if0 start ip lost tmr: enter
D (1809462) tcpip_adapter: if0 start ip lost tmr: already started
D (1812308) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1812314) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1812323) WIFI: connect to the AP fail
D (1812326) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

D (1812333) tcpip_adapter: if0 start ip lost tmr: enter
D (1812338) tcpip_adapter: if0 start ip lost tmr: already started
D (1815184) system_event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:dreamkas8, ssid_len:9, bssid:00:00:00:00:00:00, reason:201 (no ap found)
D (1815190) event: running post WIFI_EVENT:5 with handler 0x40225694 on loop 0x40107fa0
0x40225694: event_handler at /home/pavel/git/viki-wifi/application/main/wifi.c:229

E (1815199) WIFI: connect to the AP fail
D (1815202) event: running post WIFI_EVENT:5 with handler 0x40262560 on loop 0x40107fa0
0x40262560: handle_sta_disconnected at /home/pavel/esp/ESP8266_RTOS_SDK/components/tcpip_adapter/event_handlers.c:123

Other items if possible

mriksman commented 4 years ago

Confirm I am having similar issues. Length of time though is variable.

My code starts in STA mode and connects to the router fine. If the connection is lost (or I use my configuration button), it will start in APSTA mode. Normally I'll be able to see the soft AP.

But when this issue kicks up, I can't see the softAP nor will it connect to the router. Even though the router is fine.

JonathanWitthoeft commented 4 years ago

I am also experiencing this issue. I have been debugging for weeks. In my case it uses STA mode only and the time to failure is random. It has taken 1 hour to 48 hours to fail and is variable every time. When I get the 201 (no ap found) error, I have tried multiple variations of stopping wifi, deinit wifi, re-configuring wifi, re-init wifi, and restarting wifi. It never resolves the issue and the AP is never found again. I am convinced that the WiFi component is not scanning at all and reporting AP not found. As soon as the ESP8266 is power cycled, it reconnects to the AP.