From 8639f69ed7a5ff41f81024e83123a3453be49aa8 Mon Sep 17 00:00:00 2001 From: zhangyanjiao Date: Fri, 10 May 2024 16:28:52 +0800 Subject: [PATCH 01/12] fix(wifi): fix the tx issue when mesh packet lifetime remain equal to zero --- components/esp_rom/esp32c5/mp/esp32c5/ld/esp32c5.rom.pp.ld | 2 +- components/esp_rom/esp32c61/ld/esp32c61.rom.pp.ld | 2 +- components/esp_wifi/lib | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/esp_rom/esp32c5/mp/esp32c5/ld/esp32c5.rom.pp.ld b/components/esp_rom/esp32c5/mp/esp32c5/ld/esp32c5.rom.pp.ld index 1a8175af90..d5d68d5d49 100644 --- a/components/esp_rom/esp32c5/mp/esp32c5/ld/esp32c5.rom.pp.ld +++ b/components/esp_rom/esp32c5/mp/esp32c5/ld/esp32c5.rom.pp.ld @@ -74,7 +74,7 @@ lmacReachLongLimit = 0x40000cb8; lmacReachShortLimit = 0x40000cbc; lmacRecycleMPDU = 0x40000cc0; lmacRxDone = 0x40000cc4; -lmacSetTxFrame = 0x40000cc8; +/*lmacSetTxFrame = 0x40000cc8;*/ lmacTxDone = 0x40000ccc; lmacTxFrame = 0x40000cd0; lmacDisableTransmit = 0x40000cd4; diff --git a/components/esp_rom/esp32c61/ld/esp32c61.rom.pp.ld b/components/esp_rom/esp32c61/ld/esp32c61.rom.pp.ld index b69157baae..a3f9c9586d 100644 --- a/components/esp_rom/esp32c61/ld/esp32c61.rom.pp.ld +++ b/components/esp_rom/esp32c61/ld/esp32c61.rom.pp.ld @@ -48,7 +48,7 @@ lmacReachLongLimit = 0x40000b60; lmacReachShortLimit = 0x40000b64; lmacRecycleMPDU = 0x40000b68; lmacRxDone = 0x40000b6c; -lmacSetTxFrame = 0x40000b70; +/*lmacSetTxFrame = 0x40000b70;*/ lmacTxDone = 0x40000b74; lmacTxFrame = 0x40000b78; mac_tx_set_duration = 0x40000b7c; diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 97373dacc2..ddb736ba7a 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 97373dacc24433574f1b13ab6f7f564d50a7c78a +Subproject commit ddb736ba7a670e9500a8df863978319ab55af454 From 02c2356cb11dab0a1052f563c4a72fb66d09e73c Mon Sep 17 00:00:00 2001 From: Nachiket Kukade Date: Tue, 7 May 2024 22:51:22 +0530 Subject: [PATCH 02/12] fix(esp_wifi): Fix issue in selecting FTM compensation with external AP --- components/esp_wifi/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index ddb736ba7a..bcb739c215 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit ddb736ba7a670e9500a8df863978319ab55af454 +Subproject commit bcb739c215e8c06c42b11a19918414deebcea7e3 From 3dbba47d8c26a8cd984ecf40948bb1cd22013178 Mon Sep 17 00:00:00 2001 From: Shyamal Khachane Date: Tue, 14 May 2024 11:24:43 +0530 Subject: [PATCH 03/12] fix(esp_wifi): Fix issues in NAN datapath establishment 1. Resolve indefinite waiting while stopping NAN 2. Increase NDP response timeout to 8 DW's 3. Set NAN discovery beacon interval to 100 TU's as per Section 9.2 of Wi-Fi Aware Specification v4.0 --- components/esp_wifi/lib | 2 +- components/esp_wifi/wifi_apps/nan_app/src/nan_app.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index bcb739c215..8fd22ddcaf 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit bcb739c215e8c06c42b11a19918414deebcea7e3 +Subproject commit 8fd22ddcaf33a066d6f87375530475293a4b2630 diff --git a/components/esp_wifi/wifi_apps/nan_app/src/nan_app.c b/components/esp_wifi/wifi_apps/nan_app/src/nan_app.c index 64b2c5bbf0..783ce7fbfb 100644 --- a/components/esp_wifi/wifi_apps/nan_app/src/nan_app.c +++ b/components/esp_wifi/wifi_apps/nan_app/src/nan_app.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -28,12 +28,13 @@ #define NDP_REJECTED BIT5 /* Macros */ -#define MACADDR_LEN 6 +#define MACADDR_LEN 6 #define MACADDR_EQUAL(a1, a2) (memcmp(a1, a2, MACADDR_LEN)) #define MACADDR_COPY(dst, src) (memcpy(dst, src, MACADDR_LEN)) -#define NAN_DW_INTVL_MS 524 /* NAN DW interval (512 TU's ~= 524 mSec) */ -#define NAN_NDP_RESP_TIMEOUT_DW 4 +#define NAN_DW_INTVL_MS 524 /* NAN DW interval (512 TU's ~= 524 mSec) */ +#define NAN_NDP_RESP_TIMEOUT_DW 8 #define NAN_NDP_RESP_TIMEOUT NAN_NDP_RESP_TIMEOUT_DW*NAN_DW_INTVL_MS +#define NAN_NDP_TERM_TIMEOUT 2*NAN_DW_INTVL_MS /* NDP Termination Timeout - 2 DW*/ /* Global Variables */ static const char *TAG = "nan_app"; @@ -800,7 +801,7 @@ esp_err_t esp_wifi_nan_stop(void) NAN_DATA_UNLOCK(); os_event_group_clear_bits(nan_event_group, NDP_TERMINATED); - os_event_group_wait_bits(nan_event_group, NDP_TERMINATED, pdFALSE, pdFALSE, portMAX_DELAY); + os_event_group_wait_bits(nan_event_group, NDP_TERMINATED, pdFALSE, pdFALSE, pdMS_TO_TICKS(NAN_NDP_TERM_TIMEOUT)); os_event_group_clear_bits(nan_event_group, NDP_TERMINATED); /* Wait for 1 NAN DW interval (512 TU's ~= 524 mSec) for successful termination */ g_wifi_osi_funcs._task_delay(NAN_DW_INTVL_MS/portTICK_PERIOD_MS); From 4cf29dfceffb8c3bb5d494ba442974df1cb7d671 Mon Sep 17 00:00:00 2001 From: zhangyanjiao Date: Thu, 25 Apr 2024 19:14:47 +0800 Subject: [PATCH 04/12] fix(wifi): fixed sniffer and espnow issue 1. fix(wifi): fixed sniffer dump fcs error packets fail Closes https://github.com/espressif/esp-idf/issues/10777 2. fix(wifi): fixed the espnow priv parameter get error Closes https://github.com/espressif/esp-idf/issues/13693 --- components/esp_rom/esp32c2/ld/esp32c2.rom.ld | 2 +- components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld | 2 +- components/esp_wifi/lib | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld index 7f6b0ad048..c5397d877e 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld @@ -1655,7 +1655,7 @@ hal_sniffer_enable = 0x40001eec; hal_sniffer_disable = 0x40001ef0; /*hal_sniffer_rx_set_promis = 0x40001ef4;*/ hal_sniffer_rx_clr_statistics = 0x40001ef8; -hal_sniffer_set_promis_misc_pkt = 0x40001efc; +/*hal_sniffer_set_promis_misc_pkt = 0x40001efc;*/ tsf_hal_set_tsf_enable = 0x40001f00; tsf_hal_set_tsf_disable = 0x40001f04; tsf_hal_is_tsf_enabled = 0x40001f08; diff --git a/components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld b/components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld index 748ce1d1f7..7a3eabdb20 100644 --- a/components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld +++ b/components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld @@ -31,7 +31,7 @@ rcUpdateTxDone = 0x4000177c; wDevCheckBlockError = 0x400017b4; /* wDev_IndicateFrame = 0x400017c8;*/ wDev_ProcessFiq = 0x400017f0; -wDev_ProcessRxSucData = 0x400017f4; +/*wDev_ProcessRxSucData = 0x400017f4;*/ /*ppProcTxDone = 0x40001804;*/ pm_tx_data_done_process = 0x40001808; ppMapWaitTxq = 0x40001810; diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 8fd22ddcaf..11a226dcb4 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 8fd22ddcaf33a066d6f87375530475293a4b2630 +Subproject commit 11a226dcb42c092d8b85542ecd0d663dafedac6d From d2551d6e4b158b8030f858a0ac33d6a1f9421fac Mon Sep 17 00:00:00 2001 From: liuning Date: Thu, 16 May 2024 10:39:26 +0800 Subject: [PATCH 05/12] fix(wifi): fix esp32 unrecoverable m f issue --- components/esp_wifi/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 11a226dcb4..4816d356ad 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 11a226dcb42c092d8b85542ecd0d663dafedac6d +Subproject commit 4816d356ad5335c4477426713d820a11687ca4ae From 6da7a46bfaa8edb4ef9730ad1b7414c2e05ea5e8 Mon Sep 17 00:00:00 2001 From: yinqingzhao Date: Thu, 16 May 2024 14:45:06 +0800 Subject: [PATCH 06/12] fix(bss_color):fix bss color issues --- components/esp_wifi/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 4816d356ad..c230df3c50 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 4816d356ad5335c4477426713d820a11687ca4ae +Subproject commit c230df3c50ea1cbbf8104eb8c46c99672ae25e1b From beebbada649d8fec3519fe42e4fe893f1002226f Mon Sep 17 00:00:00 2001 From: yinqingzhao Date: Thu, 16 May 2024 19:20:59 +0800 Subject: [PATCH 07/12] fix(wifi):esp32c6 wifi rx statistics is always zero --- components/esp_wifi/lib | 2 +- examples/wifi/iperf/main/iperf_example_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index c230df3c50..6aa93ec85d 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit c230df3c50ea1cbbf8104eb8c46c99672ae25e1b +Subproject commit 6aa93ec85df32b54dc91c44bb0ef2d5319f757cb diff --git a/examples/wifi/iperf/main/iperf_example_main.c b/examples/wifi/iperf/main/iperf_example_main.c index 83df4b0d23..a856e20ebc 100644 --- a/examples/wifi/iperf/main/iperf_example_main.c +++ b/examples/wifi/iperf/main/iperf_example_main.c @@ -58,7 +58,7 @@ void iperf_hook_show_wifi_stats(iperf_traffic_type_t type, iperf_status_t status } #endif #if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS - if (type != IPERF_UDP_SERVER) { + if (type != IPERF_UDP_CLIENT) { wifi_cmd_get_rx_statistics(0, NULL); } #endif From e11f0304275be77fb0fa19d05893e2121e71a3b2 Mon Sep 17 00:00:00 2001 From: xuxiao Date: Tue, 7 May 2024 19:07:24 +0800 Subject: [PATCH 08/12] feat(wifi): add itwt teardown status --- components/esp_wifi/include/esp_wifi_he_types.h | 9 +++++++++ components/esp_wifi/lib | 2 +- examples/wifi/itwt/main/itwt_main.c | 8 ++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/components/esp_wifi/include/esp_wifi_he_types.h b/components/esp_wifi/include/esp_wifi_he_types.h index 0baf7a66d1..a6ba90d591 100644 --- a/components/esp_wifi/include/esp_wifi_he_types.h +++ b/components/esp_wifi/include/esp_wifi_he_types.h @@ -302,9 +302,18 @@ typedef struct { uint64_t target_wake_time; /**< TWT SP start time */ } wifi_event_sta_itwt_setup_t; +/** + * @brief iTWT teardown status + */ +typedef enum { + ITWT_TEARDOWN_FAIL, /**< station sends teardown frame fail */ + ITWT_TEARDOWN_SUCCESS, /**< 1) station successfully sends teardown frame to AP; 2) station receives teardown frame from AP */ +} wifi_itwt_teardown_status_t; + /** Argument structure for WIFI_EVENT_TWT_TEARDOWN event */ typedef struct { uint8_t flow_id; /**< flow id */ + wifi_itwt_teardown_status_t status; /**< itwt teardown status */ } wifi_event_sta_itwt_teardown_t; /** diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 6aa93ec85d..321823002f 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 6aa93ec85df32b54dc91c44bb0ef2d5319f757cb +Subproject commit 321823002fd7aa2d76b9996b95336495011525db diff --git a/examples/wifi/itwt/main/itwt_main.c b/examples/wifi/itwt/main/itwt_main.c index 1e4e1af461..cdc87359b0 100644 --- a/examples/wifi/itwt/main/itwt_main.c +++ b/examples/wifi/itwt/main/itwt_main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -183,7 +183,11 @@ static void itwt_teardown_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) { wifi_event_sta_itwt_teardown_t *teardown = (wifi_event_sta_itwt_teardown_t *) event_data; - ESP_LOGI(TAG, "flow_id %d%s", teardown->flow_id, (teardown->flow_id == 8) ? "(all twt)" : ""); + if (teardown->status == ITWT_TEARDOWN_FAIL) { + ESP_LOGE(TAG, "flow_id %d%s, twt teardown frame tx failed", teardown->flow_id, (teardown->flow_id == 8) ? "(all twt)" : ""); + } else { + ESP_LOGI(TAG, "flow_id %d%s", teardown->flow_id, (teardown->flow_id == 8) ? "(all twt)" : ""); + } } static void itwt_suspend_handler(void *arg, esp_event_base_t event_base, From fdb4197d02a7d3176cfc56cb332290a5d9e98833 Mon Sep 17 00:00:00 2001 From: Sarvesh Bodakhe Date: Sat, 18 May 2024 18:34:51 +0530 Subject: [PATCH 09/12] fix(esp_wifi): Add some bugfixes and cleanup in softAP 1. Fix wrong reason code in 'WIFI_EVENT_AP_STADISCONNECTED' event 2. cleanup in softAP for disconnecting connected station 3. Update examples to display reason while processing WIFI_EVENT_AP_STADISCONNECTED event --- components/esp_rom/esp32c2/ld/esp32c2.rom.ld | 2 +- components/esp_wifi/include/esp_wifi_types_generic.h | 2 +- components/esp_wifi/lib | 2 +- examples/bluetooth/blufi/main/blufi_example_main.c | 2 +- examples/protocols/http_server/captive_portal/main/main.c | 4 ++-- .../wifi/getting_started/softAP/main/softap_example_main.c | 4 ++-- examples/wifi/softap_sta/main/softap_sta.c | 6 +++--- examples/wifi/wps_softap_registrar/main/wps.c | 6 +++--- tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld index c5397d877e..5276d60ac0 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld @@ -1849,7 +1849,7 @@ ieee80211_alloc_tx_buf = 0x40002108; /* ieee80211_send_nulldata = 0x40002110; */ /* ieee80211_setup_robust_mgmtframe = 0x40002114; */ ieee80211_encap_null_data = 0x4000211c; -ieee80211_send_deauth = 0x40002120; +ieee80211_send_deauth_no_bss = 0x40002120; ieee80211_alloc_deauth = 0x40002124; ieee80211_send_proberesp = 0x40002128; ieee80211_getcapinfo = 0x40002130; diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index 754672d84e..0cea630458 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -903,7 +903,7 @@ typedef struct { uint8_t mac[6]; /**< MAC address of the station disconnects to soft-AP */ uint8_t aid; /**< the aid that soft-AP gave to the station disconnects to */ bool is_mesh_child; /**< flag to identify mesh child */ - uint8_t reason; /**< reason of disconnection */ + uint16_t reason; /**< reason of disconnection */ } wifi_event_ap_stadisconnected_t; /** Argument structure for WIFI_EVENT_AP_PROBEREQRECVED event */ diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 321823002f..482ab97ae3 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 321823002fd7aa2d76b9996b95336495011525db +Subproject commit 482ab97ae352dfdbaed028338a9ee45d7f2e6127 diff --git a/examples/bluetooth/blufi/main/blufi_example_main.c b/examples/bluetooth/blufi/main/blufi_example_main.c index 301a9ea72b..3e00907830 100644 --- a/examples/bluetooth/blufi/main/blufi_example_main.c +++ b/examples/bluetooth/blufi/main/blufi_example_main.c @@ -246,7 +246,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base, } case WIFI_EVENT_AP_STADISCONNECTED: { wifi_event_ap_stadisconnected_t* event = (wifi_event_ap_stadisconnected_t*) event_data; - BLUFI_INFO("station "MACSTR" leave, AID=%d", MAC2STR(event->mac), event->aid); + BLUFI_INFO("station "MACSTR" leave, AID=%d, reason=%d", MAC2STR(event->mac), event->aid, event->reason); break; } diff --git a/examples/protocols/http_server/captive_portal/main/main.c b/examples/protocols/http_server/captive_portal/main/main.c index 6111a5b37a..8dee238e86 100644 --- a/examples/protocols/http_server/captive_portal/main/main.c +++ b/examples/protocols/http_server/captive_portal/main/main.c @@ -39,8 +39,8 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base, MAC2STR(event->mac), event->aid); } else if (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); + ESP_LOGI(TAG, "station " MACSTR " leave, AID=%d, reason=%d", + MAC2STR(event->mac), event->aid, event->reason); } } diff --git a/examples/wifi/getting_started/softAP/main/softap_example_main.c b/examples/wifi/getting_started/softAP/main/softap_example_main.c index 4eba17b50b..485d74e90b 100644 --- a/examples/wifi/getting_started/softAP/main/softap_example_main.c +++ b/examples/wifi/getting_started/softAP/main/softap_example_main.c @@ -39,8 +39,8 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base, MAC2STR(event->mac), event->aid); } else if (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); + ESP_LOGI(TAG, "station "MACSTR" leave, AID=%d, reason=%d", + MAC2STR(event->mac), event->aid, event->reason); } } diff --git a/examples/wifi/softap_sta/main/softap_sta.c b/examples/wifi/softap_sta/main/softap_sta.c index 863bb963a4..e10b21ec8a 100644 --- a/examples/wifi/softap_sta/main/softap_sta.c +++ b/examples/wifi/softap_sta/main/softap_sta.c @@ -90,8 +90,8 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base, 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_AP, "Station "MACSTR" left, AID=%d", - MAC2STR(event->mac), event->aid); + ESP_LOGI(TAG_AP, "Station "MACSTR" left, AID=%d, reason:%d", + MAC2STR(event->mac), event->aid, event->reason); } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { esp_wifi_connect(); ESP_LOGI(TAG_STA, "Station started"); @@ -145,7 +145,7 @@ esp_netif_t *wifi_init_sta(void) .password = EXAMPLE_ESP_WIFI_STA_PASSWD, .scan_method = WIFI_ALL_CHANNEL_SCAN, .failure_retry_cnt = EXAMPLE_ESP_MAXIMUM_RETRY, - /* Authmode threshold resets to WPA2 as default if password matches WPA2 standards (pasword len => 8). + /* Authmode threshold resets to WPA2 as default if password matches WPA2 standards (password len => 8). * If you want to connect the device to deprecated WEP/WPA networks, Please set the threshold value * to WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK and set the password with length and format matching to * WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK standards. diff --git a/examples/wifi/wps_softap_registrar/main/wps.c b/examples/wifi/wps_softap_registrar/main/wps.c index b7f5ef8d0d..31ea230858 100644 --- a/examples/wifi/wps_softap_registrar/main/wps.c +++ b/examples/wifi/wps_softap_registrar/main/wps.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -62,8 +62,8 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base, { ESP_LOGI(TAG, "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); + ESP_LOGI(TAG, "station "MACSTR" leave, AID=%d, reason=%d", + MAC2STR(event->mac), event->aid, event->reason); } break; case WIFI_EVENT_AP_STACONNECTED: diff --git a/tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c b/tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c index 4f0cdcd7dc..fcf1770a24 100644 --- a/tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c +++ b/tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c @@ -56,7 +56,7 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base, ESP_LOGI(TAG, "station "MACSTR" join, AID=%d", MAC2STR(event->mac), event->aid); } else if (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); + ESP_LOGI(TAG, "station "MACSTR" leave, AID=%d, reason=%d", MAC2STR(event->mac), event->aid, event->reason); } } From c046d87561416b79b9e64ca10bc12b90bd4d0cf2 Mon Sep 17 00:00:00 2001 From: zhangyanjiao Date: Mon, 15 Apr 2024 17:27:01 +0800 Subject: [PATCH 10/12] docs(wifi): update the docmentation for mesh API --- components/esp_wifi/include/esp_mesh.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/components/esp_wifi/include/esp_mesh.h b/components/esp_wifi/include/esp_mesh.h index 4493653829..18e55c2dfd 100644 --- a/components/esp_wifi/include/esp_mesh.h +++ b/components/esp_wifi/include/esp_mesh.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -141,7 +141,7 @@ extern "C" { #define MESH_ASSOC_FLAG_STA_VOTED (0x04) /**< station vote done, set when connect to router */ #define MESH_ASSOC_FLAG_NETWORK_FREE (0x08) /**< no root in current network */ #define MESH_ASSOC_FLAG_STA_VOTE_EXPIRE (0x10) /**< the voted address is expired, means the voted device lose the chance to be root */ -#define MESH_ASSOC_FLAG_ROOTS_FOUND (0x20) /**< roots conflict is found, means that thre are at least two roots in the mesh network */ +#define MESH_ASSOC_FLAG_ROOTS_FOUND (0x20) /**< roots conflict is found, means that there are at least two roots in the mesh network */ #define MESH_ASSOC_FLAG_ROOT_FIXED (0x40) /**< the root is fixed in the mesh network */ /** @@ -216,7 +216,7 @@ typedef enum { MESH_ROOT, /**< the only sink of the mesh network. Has the ability to access external IP network */ MESH_NODE, /**< intermediate device. Has the ability to forward packets over the mesh network */ MESH_LEAF, /**< has no forwarding ability */ - MESH_STA, /**< connect to router with a standlone Wi-Fi station mode, no network expansion capability */ + MESH_STA, /**< connect to router with a standalone Wi-Fi station mode, no network expansion capability */ } mesh_type_t; /** @@ -642,14 +642,16 @@ esp_err_t esp_mesh_stop(void); * - Field size should not exceed MESH_MPS. Note that the size of one mesh packet should not exceed MESH_MTU. * - Field proto should be set to data protocol in use (default is MESH_PROTO_BIN for binary). * - Field tos should be set to transmission tos (type of service) in use (default is MESH_TOS_P2P for point-to-point reliable). + * - If the packet is to the root, MESH_TOS_P2P must be set to ensure reliable transmission. + * - As long as the MESH_TOS_P2P is set, the API is blocking, even if the flag is set with MESH_DATA_NONBLOCK. + * - As long as the MESH_TOS_DEF is set, the API is non-blocking. * @param[in] flag bitmap for data sent + * - Flag is at least one of the three MESH_DATA_P2P/MESH_DATA_FROMDS/MESH_DATA_TODS, which represents the direction of packet sending. * - Speed up the route search - * - If the packet is to the root and "to" parameter is NULL, set this parameter to 0. * - If the packet is to an internal device, MESH_DATA_P2P should be set. * - If the packet is to the root ("to" parameter isn't NULL) or to external IP network, MESH_DATA_TODS should be set. * - If the packet is from the root to an internal device, MESH_DATA_FROMDS should be set. - * - Specify whether this API is block or non-block, block by default - * - If needs non-blocking, MESH_DATA_NONBLOCK should be set. Otherwise, may use esp_mesh_send_block_time() to specify a blocking time. + * - Specify whether this API is blocking or non-blocking, blocking by default. * - In the situation of the root change, MESH_DATA_DROP identifies this packet can be dropped by the new root * for upstream data to external IP network, we try our best to avoid data loss caused by the root change, but * there is a risk that the new root is running out of memory because most of memory is occupied by the pending data which @@ -684,6 +686,7 @@ esp_err_t esp_mesh_send(const mesh_addr_t *to, const mesh_data_t *data, int flag, const mesh_opt_t opt[], int opt_count); /** * @brief Set blocking time of esp_mesh_send() + * - Suggest to set the blocking time to at least 5s when the environment is poor. Otherwise, esp_mesh_send() may timeout frequently. * * @attention This API shall be called before mesh is started. * @@ -1202,6 +1205,7 @@ int esp_mesh_get_xon_qsize(void); /** * @brief Set whether allow more than one root existing in one network + * - The default value is true, that is, multiple roots are allowed. * * @param[in] allowed allow or not * From 686878497e70251e6419aa408e2d2012b7cfd9bb Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Fri, 10 May 2024 12:12:38 +0800 Subject: [PATCH 11/12] docs: update wifi iperf README --- examples/wifi/iperf/README.md | 91 ++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/examples/wifi/iperf/README.md b/examples/wifi/iperf/README.md index b6ed09ea29..b42b7c4440 100644 --- a/examples/wifi/iperf/README.md +++ b/examples/wifi/iperf/README.md @@ -4,61 +4,74 @@ # Iperf Example ## Note about iperf version -The iperf example doesn't support all features in standard iperf. It's compitable with iperf version 2.x. +The iperf example doesn't support all features in standard iperf. It's compatible with iperf version 2.x. -## Note about 80MHz flash frequency +- Refer to the components registry iperf-cmd page for more information: https://components.espressif.com/components/espressif/iperf-cmd + +## Note about 80MHz flash frequency (ESP32) The iperf can get better throughput if the SPI flash frequency is set to 80MHz, but the system may crash in 80MHz mode for ESP-WROVER-KIT. Removing R140~R145 from the board can fix this issue. Currently the default SPI frequency is set to 40MHz, if you want to change the SPI flash frequency to 80MHz, please make sure R140~R145 are removed from ESP-WROVER-KIT or use ESP32 DevKitC. ## Introduction This example implements the protocol used by the common performance measurement tool [iPerf](https://iperf.fr/). -Performance can be measured between two ESP32s running this example, or between a single ESP32 and a computer running the iPerf tool +Performance can be measured between two ESP targets running this example, or between a single ESP target and a computer running the iPerf tool Demo steps to test station TCP Tx performance: -1. Configure in `menuconfig` which serial output you are using. Execute `idf.py menuconfig` and go to `Component config/ESP System Settings/Channel for console output`, then select the appropiate interface. By default the UART0 interface is used, this means that for example in the ESP32-S3-DevKitC-1 or ESP32-C6-DevKitC-1 you should connect to the micro-usb connector labeled as UART and not to the one labeled as USB. To use the one labeled as USB you should change the aforementioned setting to `USB Serial/JTAG Controller`. -2. Build the iperf example with sdkconfig.defaults, which contains performance test specific configurations +- Configure in `menuconfig` which serial output you are using. Execute `idf.py menuconfig` and go to `Component config/ESP System Settings/Channel for console output`, then select the appropriate interface. By default the UART0 interface is used, this means that for example in the ESP32-S3-DevKitC-1 or ESP32-C6-DevKitC-1 you should connect to the micro-usb connector labeled as UART and not to the one labeled as USB. To use the one labeled as USB you should change the aforementioned setting to `USB Serial/JTAG Controller`. -3. Run the demo as station mode and join the target AP - sta ssid password +- Build and flash the iperf example with `sdkconfig.defaults`, which contains performance test specific configurations + - Use `help` for detailed command usage information. -4. Run iperf as server on AP side - iperf -s -i 3 +- Run the demo as station mode and join the target AP + - `sta_connect ` + - NOTE: the dut is started in station mode by default. If you want to use the dut as softap, please set wifi mode first: + - `wifi_mode ap` + - `ap_set ` -5. Run iperf as client on ESP32 side - iperf -c 192.168.10.42 -i 3 -t 60 +- Run iperf as server on AP side + - `iperf -s -i 3` + +- Run iperf as client on ESP side + - `iperf -c 192.168.10.42 -i 3 -t 60` The console output, which is printed by station TCP RX throughput test, looks like: ->iperf> sta aptest -> ->I (5325) iperf: sta connecting to 'aptest' -> ->iperf> I (6017) event: ip: 192.168.10.248, mask: 255.255.255.0, gw: 192.168.10.1 -> ->iperf> iperf -s -i 3 -t 1000 -> ->I (14958) iperf: mode=tcp-server sip=192.168.10.248:5001, dip=0.0.0.0:5001, interval=3, time=1000 -> ->Interval Bandwidth -> ->iperf> accept: 192.168.10.42,62958 -> ->0- 3 sec 8.43 Mbits/sec -> ->3- 6 sec 36.16 Mbits/sec -> ->6- 9 sec 36.22 Mbits/sec -> ->9- 12 sec 36.44 Mbits/sec -> ->12- 15 sec 36.25 Mbits/sec -> ->15- 18 sec 24.36 Mbits/sec -> ->18- 21 sec 27.79 Mbits/sec - + ``` + iperf> sta_connect testap-11 ******** + I (36836) WIFI: Connecting to testap-11... + I (36839) WIFI: DONE.WIFI_CONNECT_START,OK. + iperf> I (39248) WIFI: WIFI_EVENT_STA_DISCONNECTED! reason: 201 + I (39249) WIFI: trying to reconnect... + I (41811) wifi:new:<11,2>, old:<1,0>, ap:<255,255>, sta:<11,2>, prof:1, snd_ch_cfg:0x0 + I (41813) wifi:state: init -> auth (0xb0) + I (41816) wifi:state: auth -> assoc (0x0) + I (41840) wifi:state: assoc -> run (0x10) + I (41847) wifi:idx:0 (ifx:0, 30:5a:3a:74:90:f0), tid:0, ssn:0, winSize:64 + I (41914) wifi:connected with testap-11, aid = 1, channel 11, 40D, bssid = 30:5a:3a:74:90:f0 + I (41915) wifi:security: WPA2-PSK, phy: bgn, rssi: -34 + I (41926) wifi:pm start, type: 0 + + I (41927) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us + I (41929) WIFI: WIFI_EVENT_STA_CONNECTED! + I (41983) wifi:AP's beacon interval = 102400 us, DTIM period = 3 + I (42929) esp_netif_handlers: sta ip: 192.168.1.79, mask: 255.255.255.0, gw: 192.168.1.1 + I (42930) WIFI: IP_EVENT_STA_GOT_IP: Interface "sta" address: 192.168.1.79 + I (42942) WIFI: - IPv4 address: 192.168.1.79, + iperf> + iperf> iperf -s -i 2 + I (84810) IPERF: mode=tcp-server sip=0.0.0.0:5001, dip=0.0.0.0:5001, interval=2, time=30 + I (84812) iperf: Socket created + iperf> I (87967) iperf: accept: 192.168.1.2,43726 + + Interval Bandwidth + 0.0- 2.0 sec 24.36 Mbits/sec + 2.0- 4.0 sec 23.38 Mbits/sec + 4.0- 6.0 sec 24.02 Mbits/sec + 6.0- 8.0 sec 25.27 Mbits/sec + 8.0-10.0 sec 23.84 Mbits/sec + ``` Steps to test station/soft-AP TCP/UDP RX/TX throughput are similar as test steps in station TCP TX. From 68be49d2cf1ade352c4d74e244ce27ddf162b01e Mon Sep 17 00:00:00 2001 From: muhaidong Date: Sun, 28 Apr 2024 20:00:37 +0800 Subject: [PATCH 12/12] fix(wifi): fixed scan get ap number issue --- examples/wifi/scan/main/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/wifi/scan/main/scan.c b/examples/wifi/scan/main/scan.c index 19e2c41555..2876fb95a5 100644 --- a/examples/wifi/scan/main/scan.c +++ b/examples/wifi/scan/main/scan.c @@ -185,8 +185,8 @@ static void wifi_scan(void) #endif /*USE_CHANNEL_BTIMAP*/ ESP_LOGI(TAG, "Max AP number ap_info can hold = %u", number); - ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); ESP_ERROR_CHECK(esp_wifi_scan_get_ap_num(&ap_count)); + ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); ESP_LOGI(TAG, "Total APs scanned = %u, actual AP number ap_info holds = %u", ap_count, number); for (int i = 0; i < number; i++) { ESP_LOGI(TAG, "SSID \t\t%s", ap_info[i].ssid);