espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.38k stars 7.22k forks source link

[esp-eye] Station mode wifi disconnected (IDFGH-13624) #14509

Open leehakgun opened 2 weeks ago

leehakgun commented 2 weeks ago

Answers checklist.

IDF version.

v4.4.0

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

PowerShell

What is the expected behavior?

Open the web page in softap mode, store nvs information, and connect the app in station mode with ssid and passwod

What is the actual behavior?

Open the web page in softap mode, store nvs information, and disconnect the app in station mode with ssid and passwod

Steps to reproduce.

void Dawon_Init_SoftAP(SysInfo *pSysinfo) {

uint8_t eth_mac[6];
char mkSsid[32];
char SetPwd[32];

memset(SetPwd, 0, sizeof(SetPwd));

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

wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));

setDns();
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA)); //WIFI_MODE_AP
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &dwd_event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &dwd_event_handler, NULL));

esp_wifi_get_mac(ESP_IF_WIFI_AP, eth_mac);
if(pSysinfo->DeviceMeasureType == DWD_TYPE_THREE_100A)
{
    sprintf(mkSsid, DWD_SSID_PREPIX_3P100A"%02x%02x%02x", eth_mac[3], eth_mac[4], eth_mac[5]);
}else if(pSysinfo->DeviceMeasureType == DWD_TYPE_THREE_400A)
{
    sprintf(mkSsid, DWD_SSID_PREPIX_3P400A"%02x%02x%02x", eth_mac[3], eth_mac[4], eth_mac[5]);
}else if(pSysinfo->DeviceMeasureType == DWD_TYPE_THREE_800A)
{
    sprintf(mkSsid, DWD_SSID_PREPIX_3P800A"%02x%02x%02x", eth_mac[3], eth_mac[4], eth_mac[5]);
}else
{
    sprintf(mkSsid, DWD_SSID_PREPIX_1P"%02x%02x%02x", eth_mac[3], eth_mac[4], eth_mac[5]);
}
sprintf(pSysinfo->mac_st, "%02x%02x%02x%02x%02x%02x", eth_mac[0], eth_mac[1], eth_mac[2], eth_mac[3], eth_mac[4], eth_mac[5]);

wifi_config_t wifi_config = {
    .ap = {
        .max_connection = DWD_MAX_STA_CONN,
        //.authmode = WIFI_AUTH_WPA_WPA2_PSK,
        //.ssid_hidden = false,
        .beacon_interval = 100
    },
};

if (dwd_wifi_events == NULL) {
    dwd_wifi_events = xEventGroupCreate();
}

memset(&(wifi_config.ap.ssid[0]), 0, sizeof(wifi_config.ap.ssid));
memset(&(wifi_config.ap.password[0]), 0, sizeof(wifi_config.ap.password));

wifi_config.ap.ssid_len = sprintf((char *)&wifi_config.ap.ssid, "%s", mkSsid);

if (strlen(SetPwd) == 0)
{
    wifi_config.ap.authmode = WIFI_AUTH_OPEN;
    ESP_LOGI(TAG, "wifi_init_softap finished. SSID[%d]:%s", wifi_config.ap.ssid_len, mkSsid);
}else
{
    wifi_config.ap.authmode = WIFI_AUTH_WPA_WPA2_PSK;
    sprintf((char *)&wifi_config.ap.password, "%s", SetPwd);
    ESP_LOGI(TAG, "wifi_init_softap finished. SSID:%s password:%s", mkSsid, SetPwd);
}

ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_start());

ESP_ERROR_CHECK(esp_wifi_set_protocol(ESP_IF_WIFI_AP, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N));

start_webserver();

}

int Dawon_Init_Station(SysInfo *pSysinfo) {

uint8_t eth_mac[6];
esp_err_t ret_value = ESP_OK;

dwd_wifi_event_group = xEventGroupCreate();

ESP_ERROR_CHECK(esp_netif_init());

ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_create_default_wifi_sta();

//esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();
//assert(sta_netif);

wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));

ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &dwd_event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &dwd_event_handler, NULL));

esp_wifi_get_mac(ESP_IF_WIFI_STA, eth_mac);
sprintf(pSysinfo->mac_st, "%02x%02x%02x%02x%02x%02x", eth_mac[0], eth_mac[1], eth_mac[2], eth_mac[3], eth_mac[4], eth_mac[5]);

wifi_config_t wifi_config = {
    .sta = {
        .ssid = EXAMPLE_ESP_WIFI_SSID,
        .password = EXAMPLE_ESP_WIFI_PASS,
        .threshold.authmode = WIFI_AUTH_WPA_WPA2_PSK,
        .channel = 5
    },
};
printf("ssid: %s\n", wifi_config.sta.ssid);
printf("password: %s\n", wifi_config.sta.password);

memset(wifi_config.sta.ssid, 0, sizeof(wifi_config.sta.ssid));
memset(wifi_config.sta.password, 0, sizeof(wifi_config.sta.password));

sprintf((char *)&wifi_config.sta.ssid, "%s", pSysinfo->NvPram.ssid);
sprintf((char *)&wifi_config.sta.password, "%s", pSysinfo->NvPram.password);

size_t free_heap_size = esp_get_free_heap_size();
ESP_LOGI(TAG, "Free heap size before Wi-Fi start: %d bytes", free_heap_size);

ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_start());

esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);

ESP_LOGI(TAG, "wifi_init_sta finished.");

/* Waiting until either the connection is established (DWD_WIFI_CONNECTED_BIT) or connection failed for the maximum
 * number of re-tries (DWD_WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */
EventBits_t bits = xEventGroupWaitBits(dwd_wifi_event_group,
        DWD_WIFI_CONNECTED_BIT | DWD_WIFI_FAIL_BIT,
        pdFALSE,
        pdFALSE,
        portMAX_DELAY);

/* xEventGroupWaitBits() returns the bits before the call returned, hence we can test which event actually
 * happened. */
if (bits & DWD_WIFI_CONNECTED_BIT)
{
    ESP_LOGI(TAG, "connected to ap SSID:%s password:%s", wifi_config.sta.ssid, wifi_config.sta.password);
}else if (bits & DWD_WIFI_FAIL_BIT)
{
    ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s", wifi_config.sta.ssid, wifi_config.sta.password); 
    esp_restart();
    ret_value = ESP_FAIL;
}else
{
    ESP_LOGE(TAG, "UNEXPECTED EVENT");
    ret_value = ESP_ERR_INVALID_STATE;
}

vEventGroupDelete(dwd_wifi_event_group);

return ret_value;

}

static void dwd_event_handler(void arg, esp_event_base_t event_base, int32_t event_id, void event_data) { printf("Received event_base: %s\n", event_base);

if(event_base == WIFI_EVENT){

    wifi_handler(arg, event_id, event_data);}
else if(event_base == IP_EVENT){

    ip_handler(arg, event_id, event_data);}
else
{}

}

static void wifi_handler(void arg, int32_t event_id, void event_data) {
SysInfo *pSysinfo = GetSysInfo();

ESP_LOGI(TAG, "[%s:%d] event : %s", __FUNCTION__, __LINE__, wifi_Event2Char(event_id));
switch(event_id)
{
    case WIFI_EVENT_WIFI_READY:             /**< ESP32 WiFi ready */
        break;
    case WIFI_EVENT_SCAN_DONE:              /**< ESP32 finish scanning AP */
        break;
    case WIFI_EVENT_STA_START:          /**< ESP32 station start */
        printf("ssid: %s\n", pSysinfo->NvPram.ssid);
        printf("password: %s\n", pSysinfo->NvPram.password);
        esp_wifi_connect();
        break;
    case WIFI_EVENT_STA_STOP:               /**< ESP32 station stop */
        break;
    case WIFI_EVENT_STA_CONNECTED:          /**< ESP32 station connected to AP */
        break;
    case WIFI_EVENT_STA_DISCONNECTED:       /**< ESP32 station disconnected from AP */
        ESP_LOGI(TAG, "Connection to the AP failed");
        wifi_event_sta_disconnected_t* event = (wifi_event_sta_disconnected_t*) event_data;
        ESP_LOGE(TAG, "Disconnect reason: %d", event->reason);
        if (dwd_station_retry_num < 100)
        {
            esp_wifi_connect();
            dwd_station_retry_num++;
            vTaskDelay(pdMS_TO_TICKS(300)); 
            ESP_LOGI(TAG, "retry to connect to the AP");
        }else
        {
            xEventGroupSetBits(dwd_wifi_event_group, DWD_WIFI_FAIL_BIT);
            ESP_LOGI(TAG, "Reboot...");
            esp_restart();
        }
        ESP_LOGI(TAG,"connect to the AP fail");
        Dawon_SetWiFiStatusLED(DWD_LED_STATUS_SOFTAP_MODE_DISCONNECTED);
        break;
    case WIFI_EVENT_STA_AUTHMODE_CHANGE:    /**< the auth mode of AP connected by ESP32 station changed */
        break;
    case WIFI_EVENT_STA_WPS_ER_SUCCESS:     /**< ESP32 station wps succeeds in enrollee mode */
        break;
    case WIFI_EVENT_STA_WPS_ER_FAILED:      /**< ESP32 station wps fails in enrollee mode */
        break;
    case WIFI_EVENT_STA_WPS_ER_TIMEOUT:     /**< ESP32 station wps timeout in enrollee mode */
        break;
    case WIFI_EVENT_STA_WPS_ER_PIN:         /**< ESP32 station wps pin code in enrollee mode */
        break;
    case WIFI_EVENT_STA_WPS_ER_PBC_OVERLAP: /**< ESP32 station wps overlap in enrollee mode */
        break;
    case WIFI_EVENT_AP_START:               /**< ESP32 soft-AP start */
        Dawon_TCP_Server_Start();
        break;
    case WIFI_EVENT_AP_STOP:                /**< ESP32 soft-AP stop */
        break;
    case WIFI_EVENT_AP_STACONNECTED:        /**< a station connected to ESP32 soft-AP */
    {
        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);
    }
        break;
    case WIFI_EVENT_AP_STADISCONNECTED:     /**< a station disconnected from ESP32 soft-AP */
    {
        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);
    }
        break;
    case WIFI_EVENT_AP_PROBEREQRECVED:      /**< Receive probe request packet in soft-AP interface */
        break;
    case WIFI_EVENT_MAX:                    /**< Invalid WiFi event ID */
        break;
    default:
        break;
}

}

static void ip_handler(void arg, int32_t event_id, void event_data) { ESP_LOGI(TAG, "[%s:%d] event : %s", FUNCTION, LINE, ip_Event2Char(event_id)); SysInfo *ptmpSysinfo = GetSysInfo();

switch(event_id)
{
    case IP_EVENT_STA_GOT_IP:           /*!< station got IP from connected AP */
        {
            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(ptmpSysinfo->LocalIp, IPSTR, IP2STR(&event->ip_info.ip));
            //ESP_LOGI(TAG, "got ip:" "%s", ptmpSysinfo->LocalIp);
            ESP_LOGI(TAG, "got ip:%s", ip4addr_ntoa(&event->ip_info.ip));
            dwd_station_retry_num = 0;
            xEventGroupSetBits(dwd_wifi_event_group, DWD_WIFI_CONNECTED_BIT);
            printf("f_Getapikey : %d\r\n", ptmpSysinfo->NvPram.f_Getapikey);

ifdef DWD_SERVER_CONNECTION_V2

            if(ptmpSysinfo->NvPram.f_Getapikey != DWD_START)

else

            if(ptmpSysinfo->NvPram.f_Getapikey == DWD_FALSE)

endif

            {

                Dawon_SetWiFiStatusLED(DWD_LED_STATUS_HTTP_MODE);
                Dawon_Start_Apikey();

            }else
            {   
                Dawon_MqttStart();
            }
        }
        break;
    case IP_EVENT_STA_LOST_IP:          /*!< station lost IP and the IP is reset to 0 */
        break;
    case IP_EVENT_AP_STAIPASSIGNED:     /*!< soft-AP assign an IP to a connected station */
        break;
    case IP_EVENT_GOT_IP6:              /*!< station or ap or ethernet interface v6IP addr is preferred */
        break;
    case IP_EVENT_ETH_GOT_IP:           /*!< ethernet got IP from connected AP */
        break;
    case IP_EVENT_PPP_GOT_IP:           /*!< PPP interface got IP */
        break;
    case IP_EVENT_PPP_LOST_IP:          /*!< PPP interface lost IP */
        break;
    default:
        break;
}

}

Build or installation Logs.

I (26) boot: compile time 09:12:48
I (26) boot: chip revision: 1
I (29) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (36) boot.esp32: SPI Speed      : 40MHz
I (41) boot.esp32: SPI Mode       : DIO
I (45) boot.esp32: SPI Flash Size : 4MB
I (50) boot: Enabling RNG early entropy source...
I (55) boot: Partition Table:
I (59) boot: ## Label            Usage          Type ST Offset   Length
I (66) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (73) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (81) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (88) boot:  3 factory          factory app      00 00 00010000 00100000
I (96) boot:  4 ota_0            OTA app          00 10 00110000 00100000
I (103) boot:  5 ota_1            OTA app          00 11 00210000 00100000
I (111) boot: End of partition table
I (115) boot: Defaulting to factory image
I (120) boot_comm: chip revision: 1, min. application chip revision: 0
I (127) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=22ec4h (143044) map
I (187) esp_image: segment 1: paddr=00032eec vaddr=3ffb0000 size=039a0h ( 14752) load
I (193) esp_image: segment 2: paddr=00036894 vaddr=40080000 size=09784h ( 38788) load
I (210) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=a9434h (693300) map
I (461) esp_image: segment 4: paddr=000e945c vaddr=40089784 size=0c254h ( 49748) load
I (481) esp_image: segment 5: paddr=000f56b8 vaddr=50000000 size=00010h (    16) load
I (492) boot: Loaded app from partition at offset 0x10000
I (492) boot: Disabling RNG early entropy source...
I (504) cpu_start: Pro cpu up.
I (504) cpu_start: Starting app cpu, entry point is 0x400812e0
0x400812e0: call_start_cpu1 at C:/Users/admin/esp/v4.4/esp-idf/components/esp_system/port/cpu_start.c:156

I (0) cpu_start: App cpu up.
I (520) cpu_start: Pro cpu start user code
I (520) cpu_start: cpu freq: 240000000
I (520) cpu_start: Application information:
I (525) cpu_start: Project name:     PM-P230-ES-WE
I (530) cpu_start: App version:      1f5fa1a-dirty
I (536) cpu_start: Compile time:     Sep  5 2024 09:12:21
I (542) cpu_start: ELF file SHA256:  83f297ff68179ea4...
I (548) cpu_start: ESP-IDF:          v4.4-dirty
I (553) heap_init: Initializing. RAM available for dynamic allocation:
I (560) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (566) heap_init: At 3FFBF990 len 00020670 (129 KiB): DRAM
I (573) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (579) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (585) heap_init: At 400959D8 len 0000A628 (41 KiB): IRAM
I (593) spi_flash: detected chip: generic
I (596) spi_flash: flash io: dio
I (601) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.

------------------------------
 IoT Energy Saving Start!!!
 Model Name : PM-P230-ES-WE
 Version    : 1.01.00
------------------------------
---------- nvs read! ----------
 Server_connect : 0
 ssid :
 password :
 apiServerUrl :
 apikey :
 mqttServerURL :
 userId : 
 LedStatus : DWD_LED_STATUS_SOFTAP_MODE_IDLE
-------------------------------
I (718) NVS: Data read successfully from NVS.
1P => Save Mode!!!
E (726) uart: uart_write_bytes(1214): uart driver error
I (726) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (732) EnergySaver: UART initialized successfully
I (741) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
2e2e2e2e2e2e2e2
I (755) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
DWD_LED_STATUS_PROGRESS
@@@@@@@@@@@@@@@@@@@@@@@@@@@0
4444444444444444444444444
I (772) EnergySaver: [APP] Dawon_TCP_Server_Start.....
Dawon_Init_SoftAP 시작~~~~~~~~~~
I (785) wifi:wifi driver task: 3ffcf294, prio:23, stack:6656, core=0
I (788) system_api: Base MAC address is not set
I (793) system_api: read default base MAC address from EFUSE
I (813) wifi:wifi firmware version: 7679c42
I (813) wifi:wifi certification version: v7.0
I (813) wifi:config NVS flash: enabled
I (813) wifi:config nano formating: disabled
I (818) wifi:Init data frame dynamic rx buffer num: 32
I (822) wifi:Init management frame dynamic rx buffer num: 32
I (828) wifi:Init management short buffer num: 32
I (832) wifi:Init dynamic tx buffer num: 32
I (836) wifi:Init static rx buffer size: 1600
I (840) wifi:Init static rx buffer num: 10
I (844) wifi:Init dynamic rx buffer num: 32
I (849) wifi_init: rx ba win: 6
I (852) wifi_init: tcpip mbox: 32
I (856) wifi_init: udp mbox: 6
I (859) wifi_init: tcp mbox: 6
I (863) wifi_init: tcp tx win: 5744
I (868) wifi_init: tcp rx win: 5744
I (875) wifi_init: tcp mss: 1440
I (875) wifi_init: WiFi IRAM OP enabled
I (880) wifi_init: WiFi RX IRAM OP enabled
I (886) dwd softAP&Station: wifi_init_softap finished. SSID[16]:DWD-ES310_eb2cfd
I (897) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (1000) wifi:mode : sta (24:0a:c4:eb:2c:fc) + softAP (24:0a:c4:eb:2c:fd)
I (1001) wifi:enable tsf
I (1002) wifi:Total power save buffer number: 16
I (1003) wifi:Init max length of beacon: 752/752
I (1008) wifi:Init max length of beacon: 752/752
Received event_base: WIFI_EVENT
wifi 이벤트
I (1016) dwd softAP&Station: [wifi_handler:120] event : WIFI_EVENT_STA_START
ssid:
password:
I (1028) dwd softAP&Station: SoftAP모드 Wi-Fi 프로토콜 모드가 BGN으로 설정되었습니다.
I (1035) wifi:ap channel adjust o:1,1 n:5,2
I (1039) wifi:new:<5,2>, old:<1,1>, ap:<5,2>, sta:<5,2>, prof:1
I (1046) wifi:state: init -> auth (b0)
Received event_base: WIFI_EVENT
wifi 이벤트
I (1053) dwd softAP&Station: [wifi_handler:120] event : WIFI_EVENT_AP_START
I (1056) wifi:state: auth -> assoc (0)
I (1061) tcp_server: Socket created
I (1068) tcp_server: Socket binded
I (1068) wifi:state: assoc -> run (10)I (1072) tcp_server: Socket listening

I (1069) dwd softAP&Station: Webserver started successfully.
DWD_LED_STATUS_SOFTAP_MODE_IDLE
I (5297) wifi:state: run -> init (fc0)
I (5298) wifi:new:<5,0>, old:<5,2>, ap:<5,2>, sta:<5,2>, prof:1
I (5300) wifi:new:<5,0>, old:<5,0>, ap:<5,2>, sta:<5,2>, prof:1
Received event_base: WIFI_EVENT
wifi 이벤트
I (5306) dwd softAP&Station: [wifi_handler:120] event : WIFI_EVENT_STA_DISCONNECTED
I (5314) dwd softAP&Station: Connection to the AP failed
E (5320) dwd softAP&Station: Disconnect reason: 15
I (5627) dwd softAP&Station: retry to connect to the AP
I (5627) dwd softAP&Station: connect to the AP fail
DWD_LED_STATUS_SOFTAP_MODE_DISCONNECTED
Received event_base: WIFI_EVENT
wifi 이벤트
I (7772) dwd softAP&Station: [wifi_handler:120] event : WIFI_EVENT_STA_DISCONNECTED
I (7773) dwd softAP&Station: Connection to the AP failed
E (7779) dwd softAP&Station: Disconnect reason: 205
I (7791) wifi:new:<5,2>, old:<5,0>, ap:<5,2>, sta:<5,2>, prof:1
I (7793) wifi:state: init -> auth (b0)
I (7796) wifi:state: auth -> assoc (0)
I (7802) wifi:state: assoc -> run (10)
I (7813) wifi:connected with dawonlap, aid = 11, channel 5, 40D, bssid = 58:86:94:8e:33:b2
I (7814) wifi:security: WPA2-PSK, phy: bgn, rssi: -46
I (7820) wifi:pm start, type: 1

W (7834) wifi:<ba-add>idx:0 (ifx:0, 58:86:94:8e:33:b2), tid:0, ssn:2, winSize:64
I (7901) wifi:AP's beacon interval = 102400 us, DTIM period = 3
W (7905) wifi:<ba-add>idx:1 (ifx:0, 58:86:94:8e:33:b2), tid:6, ssn:0, winSize:64
I (8086) dwd softAP&Station: retry to connect to the AP
I (8086) dwd softAP&Station: connect to the AP fail
DWD_LED_STATUS_SOFTAP_MODE_DISCONNECTED
Received event_base: WIFI_EVENT
wifi 이벤트
I (8094) dwd softAP&Station: [wifi_handler:120] event : WIFI_EVENT_STA_CONNECTED
I (8736) wifi:new:<5,2>, old:<5,2>, ap:<5,2>, sta:<5,2>, prof:1
I (8737) wifi:station: c8:8a:9a:f3:31:d5 join, AID=1, bgn, 40D
Received event_base: WIFI_EVENT
wifi 이벤트
I (8741) dwd softAP&Station: [wifi_handler:120] event : WIFI_EVENT_AP_STACONNECTED
I (8749) dwd softAP&Station: station c8:8a:9a:f3:31:d5 join, AID=1
I (8881) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.244.2
Received event_base: IP_EVENT
ip 이벤트
 I (8883) dwd softAP&Station: [ip_handler:195] event : IP_EVENT_AP_STAIPASSIGNED
W (9012) wifi:<ba-add>idx:2 (ifx:1, c8:8a:9a:f3:31:d5), tid:0, ssn:20, winSize:64
resetstatus: 1
I (24106) NVS: Data committed successfully.
I (24111) wifi:state: run -> init (0)
I (24112) wifi:pm stop, total sleep time: 10321245 us / 16292372 us

W (24113) wifi:<ba-del>idx
W (24114) wifi:<ba-del>idx
I (24117) wifi:new:<5,2>, old:<5,2>, ap:<5,2>, sta:<5,2>, prof:1
I (24123) wifi:station: c8:8a:9a:f3:31:d5 leave, AID = 1, bss_flags is 134243, bss:0x3ffda3b4
I (24131) wifi:new:<5,0>, old:<5,2>, ap:<5,2>, sta:<5,2>, prof:1
W (24137) wifi:<ba-del>idx
Received event_base: WIFI_EVENT
wifi 이벤트
I (24143) dwd softAP&Station: [wifi_handler:120] event : WIFI_EVENT_STA_DISCONNECTED
I (24151) dwd softAP&Station: Connection to the AP failed
E (24157) dwd softAP&Station: Disconnect reason: 8
I (24209) wifi:flush txq
I (24209) wifi:stop sw txq
I (24210) wifi:lmac stop hw txq
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6612
load:0x40078000,len:14780
load:0x40080400,len:3792
0x40080400: _init at ??:?

entry 0x40080694
I (27) boot: ESP-IDF v4.4-dirty 2nd stage bootloader
I (27) boot: compile time 09:12:48
I (27) boot: chip revision: 1
I (30) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (37) boot.esp32: SPI Speed      : 40MHz
I (42) boot.esp32: SPI Mode       : DIO
I (46) boot.esp32: SPI Flash Size : 4MB
I (51) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (60) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (75) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (82) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (90) boot:  3 factory          factory app      00 00 00010000 00100000
I (97) boot:  4 ota_0            OTA app          00 10 00110000 00100000
I (105) boot:  5 ota_1            OTA app          00 11 00210000 00100000
I (112) boot: End of partition table
I (116) boot: Defaulting to factory image
I (121) boot_comm: chip revision: 1, min. application chip revision: 0
I (128) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=22ec4h (143044) map
I (189) esp_image: segment 1: paddr=00032eec vaddr=3ffb0000 size=039a0h ( 14752) load
I (195) esp_image: segment 2: paddr=00036894 vaddr=40080000 size=09784h ( 38788) load
I (211) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=a9434h (693300) map
I (462) esp_image: segment 4: paddr=000e945c vaddr=40089784 size=0c254h ( 49748) load
I (483) esp_image: segment 5: paddr=000f56b8 vaddr=50000000 size=00010h (    16) load
I (493) boot: Loaded app from partition at offset 0x10000
I (494) boot: Disabling RNG early entropy source...
I (505) cpu_start: Pro cpu up.
I (506) cpu_start: Starting app cpu, entry point is 0x400812e0
0x400812e0: call_start_cpu1 at C:/Users/admin/esp/v4.4/esp-idf/components/esp_system/port/cpu_start.c:156

I (492) cpu_start: App cpu up.
I (522) cpu_start: Pro cpu start user code
I (522) cpu_start: cpu freq: 240000000
I (522) cpu_start: Application information:
I (526) cpu_start: Project name:     PM-P230-ES-WE
I (532) cpu_start: App version:      1f5fa1a-dirty
I (537) cpu_start: Compile time:     Sep  5 2024 09:12:21
I (543) cpu_start: ELF file SHA256:  83f297ff68179ea4...
I (549) cpu_start: ESP-IDF:          v4.4-dirty
I (555) heap_init: Initializing. RAM available for dynamic allocation:
I (562) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (568) heap_init: At 3FFBF990 len 00020670 (129 KiB): DRAM
I (574) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (580) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (587) heap_init: At 400959D8 len 0000A628 (41 KiB): IRAM
I (594) spi_flash: detected chip: generic
I (598) spi_flash: flash io: dio
I (603) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.

------------------------------
 IoT Energy Saving Start!!!
 Model Name : PM-P230-ES-WE
 Version    : 1.01.00
------------------------------
---------- nvs read! ----------
 Server_connect : 0
 ssid : dawonlap
 password : iamdawon
 apiServerUrl :
 apikey : 1
 mqttServerURL : 192.168.10.56
 userId : Dawon-240ac4eb2cfd
 LedStatus : DWD_LED_STATUS_SOFTAP_MODE_DISCONNECTED
-------------------------------
I (730) NVS: Data read successfully from NVS.
1P => Normal Mode!!!
E (738) uart: uart_write_bytes(1214): uart driver error
I (738) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (744) EnergySaver: UART initialized successfully
I (753) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (767) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
2e2e2e2e2e2e2e2
DWD_LED_STATUS_SOFTAP_MODE_DISCONNECTED
factory reset!
@@@@@@@@@@@@@@@@@@@@@@@@@@@1
!!!!!!!!!!!!!!!!!!!!!!!1
3e3e33e3e3ee3e33e3e
I (883) EnergySaver: [APP] Dawon_Init_Station Start!!
Dawon_Init_Station 시작~~~~~~~~~~
I (891) wifi:wifi driver task: 3ffcf2cc, prio:23, stack:6656, core=0
I (893) system_api: Base MAC address is not set
I (898) system_api: read default base MAC address from EFUSE
I (918) wifi:wifi firmware version: 7679c42
I (919) wifi:wifi certification version: v7.0
I (919) wifi:config NVS flash: enabled
I (919) wifi:config nano formating: disabled
I (923) wifi:Init data frame dynamic rx buffer num: 32
I (928) wifi:Init management frame dynamic rx buffer num: 32
I (933) wifi:Init management short buffer num: 32
I (938) wifi:Init dynamic tx buffer num: 32
I (942) wifi:Init static rx buffer size: 1600
I (946) wifi:Init static rx buffer num: 10
I (949) wifi:Init dynamic rx buffer num: 32
I (954) wifi_init: rx ba win: 6
I (957) wifi_init: tcpip mbox: 32
I (964) wifi_init: udp mbox: 6
I (965) wifi_init: tcp mbox: 6
I (969) wifi_init: tcp tx win: 5744
I (973) wifi_init: tcp rx win: 5744
I (977) wifi_init: tcp mss: 1440
I (981) wifi_init: WiFi IRAM OP enabled
I (1027) wifi_init: WiFi RX IRAM OP enabled
ssid: dawonlap
password: iamdawon
I (1028) dwd softAP&Station: Free heap size before Wi-Fi start: 175680 bytes
I (1059) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (1155) wifi:mode : sta (24:0a:c4:eb:2c:fc)
I (1156) wifi:enable tsf
I (1158) dwd softAP&Station: Station모드 Wi-Fi 프로토콜 모드가 BGN으로 설정되었습니다.
Received event_base: WIFI_EVENT
wifi 이벤트
I (1166) dwd softAP&Station: [wifi_handler:120] event : WIFI_EVENT_STA_START
ssid:
password:
I (1175) dwd softAP&Station: wifi_init_sta finished.
I (1762) wifi:flush txq
I (1763) wifi:stop sw txq
I (1763) wifi:lmac stop hw txq
Received ets Jun  8 2016 00:22:57

More Information.

No response

hansw123 commented 3 hours ago

hi @leehakgun sorry for late reply,Can you replace the Korean in the reproduction code with English?

hansw123 commented 2 hours ago

@leehakgun can you describe your issue more detailed?