diff --git a/docs/en/api-guides/wifi.rst b/docs/en/api-guides/wifi.rst index 468da32181..04689c7f02 100644 --- a/docs/en/api-guides/wifi.rst +++ b/docs/en/api-guides/wifi.rst @@ -1445,13 +1445,13 @@ WPA2-Enterprise WPA2-Enterprise is the secure authentication mechanism for enterprise wireless networks. It uses RADIUS server for authentication of network users before connecting to the Access Point. The authentication process is based on 802.1X policy and comes with different Extended Authentication Protocol (EAP) methods like TLS, TTLS, PEAP etc. RADIUS server authenticates the users based on their credentials (username and password), digital certificates or both. When {IDF_TARGET_NAME} in Station mode tries to connect to an AP in enterprise mode, it sends authentication request to AP which is sent to RADIUS server by AP for authenticating the Station. Based on different EAP methods, the parameters can be set in configuration which can be opened using ``idf.py menuconfig``. WPA2_Enterprise is supported by {IDF_TARGET_NAME} only in Station mode. -For establishing a secure connection, AP and Station negotiate and agree on the best possible cipher suite to be used. {IDF_TARGET_NAME} supports 802.1X/EAP (WPA) method of AKM and Advanced encryption standard with Counter Mode Cipher Block Chaining Message Authentication protocol (AES-CCM) cipher suite. It also supports the cipher suites supported by mbedtls if `USE_MBEDTLS_CRYPTO` flag is set. +For establishing a secure connection, AP and Station negotiate and agree on the best possible cipher suite to be used. {IDF_TARGET_NAME} supports 802.1X/EAP (WPA) method of AKM and Advanced encryption standard with Counter Mode Cipher Block Chaining Message Authentication protocol (AES-CCM) cipher suite. It also supports the cipher suites supported by mbedtls if `USE_MBEDTLS_CRYPTO` flag is set. {IDF_TARGET_NAME} currently supports the following EAP methods: - EAP-TLS: This is certificate based method and only requires SSID and EAP-IDF. - PEAP: This is Protected EAP method. Username and Password are mandatory. - - EAP-TTLS: This is credentials based method. Only server authentication is mandatory while user authentication is optional. Username and Password are mandatory. It supports different Phase2 methods like, + - EAP-TTLS: This is credentials based method. Only server authentication is mandatory while user authentication is optional. Username and Password are mandatory. It supports different Phase2 methods like, - PAP: Password Authentication Protocol. - CHAP: Challenge Handshake Authentication Protocol. - MSCHAP and MSCHAP-V2. @@ -1872,7 +1872,7 @@ Wi-Fi Fragment supports Wi-Fi receiving fragment, but doesn't support Wi-Fi transmitting fragment. .. only:: esp32c3 - + ESP32C3 supports Wi-Fi receiving and transmitting fragment. WPS Enrollee @@ -1993,7 +1993,7 @@ Increasing the size or number of the buffers mentioned above properly can improv .. only:: esp32s2 - **CACHE:** + **CACHE:** - :ref:`CONFIG_ESP32S2_INSTRUCTION_CACHE_SIZE` Configure the size of the instruction cache. @@ -2038,13 +2038,13 @@ The parameters not mentioned in the following table should be set to the default +----------------------------+-------+----------+------------------+----------+---------+---------------+---------+ | LWIP_IRAM_OPTIMIZATION | 13 | 13 | 13 | 13 | 13 | 13 | 13 | +----------------------------+-------+----------+------------------+----------+---------+---------------+---------+ - | TCP TX throughput | 74.6 | 50.8 | 46.5 | 39.9 | 44.2 | 33.8 | 25.6 | + | TCP TX throughput (Mbit/s) | 74.6 | 50.8 | 46.5 | 39.9 | 44.2 | 33.8 | 25.6 | +----------------------------+-------+----------+------------------+----------+---------+---------------+---------+ - | TCP RX throughput | 63.6 | 35.5 | 42.3 | 48.5 | 40.5 | 30.1 | 27.8 | + | TCP RX throughput (Mbit/s) | 63.6 | 35.5 | 42.3 | 48.5 | 40.5 | 30.1 | 27.8 | +----------------------------+-------+----------+------------------+----------+---------+---------------+---------+ - | UDP TX throughput | 76.2 | 75.1 | 74.1 | 72.4 | 69.6 | 64.1 | 36.5 | + | UDP TX throughput (Mbit/s) | 76.2 | 75.1 | 74.1 | 72.4 | 69.6 | 64.1 | 36.5 | +----------------------------+-------+----------+------------------+----------+---------+---------------+---------+ - | UDP RX throughput | 83.1 | 66.3 | 75.1 | 75.6 | 73.1 | 65.3 | 54.7 | + | UDP RX throughput (Mbit/s) | 83.1 | 66.3 | 75.1 | 75.6 | 73.1 | 65.3 | 54.7 | +----------------------------+-------+----------+------------------+----------+---------+---------------+---------+ .. only:: esp32s2 @@ -2052,38 +2052,38 @@ The parameters not mentioned in the following table should be set to the default +----------------------------+-------+------------------+---------+---------------+---------+ | Rank | Iperf | High-performance | Default | Memory saving | Minimum | +============================+=======+==================+=========+===============+=========+ - | Available memory(KB) | 4.1 | 24.2 | 78.4 | 86.5 | 116.4 | + | Available memory (KB) | 4.1 | 24.2 | 78.4 | 86.5 | 116.4 | +----------------------------+-------+------------------+---------+---------------+---------+ - | WIFI_STATIC_RX_BUFFER_NUM | 8 |6 | 6 | 4 | 3 | + | WIFI_STATIC_RX_BUFFER_NUM | 8 |6 | 6 | 4 | 3 | +----------------------------+-------+------------------+---------+---------------+---------+ - | WIFI_DYNAMIC_RX_BUFFER_NUM | 24 | 18 | 12 | 8 | 6 | + | WIFI_DYNAMIC_RX_BUFFER_NUM | 24 | 18 | 12 | 8 | 6 | +----------------------------+-------+------------------+---------+---------------+---------+ - | WIFI_DYNAMIC_TX_BUFFER_NUM | 24 | 18 | 12 | 8 | 6 | + | WIFI_DYNAMIC_TX_BUFFER_NUM | 24 | 18 | 12 | 8 | 6 | +----------------------------+-------+------------------+---------+---------------+---------+ - | WIFI_RX_BA_WIN | 12 | 9 | 6 | 4 | 3 | + | WIFI_RX_BA_WIN | 12 | 9 | 6 | 4 | 3 | + +----------------------------+-------+------------------+---------+---------------+---------+ + | TCP_SND_BUF_DEFAULT (KB) | 24 | 18 | 12 | 8 | 6 | + +----------------------------+-------+------------------+---------+---------------+---------+ + | TCP_WND_DEFAULT(KB) | 24 | 18 | 12 | 8 | 6 | +----------------------------+-------+------------------+---------+---------------+---------+ - | TCP_SND_BUF_DEFAULT(KB) | 24 | 18 | 12 | 8 | 6 | - +----------------------------+-------+------------------+---------+---------------+---------+ - | TCP_WND_DEFAULT(KB) | 24 | 18 | 12 | 8 | 6 | - +----------------------------+-------+------------------+---------+---------------+---------+ | WIFI_IRAM_OPT | 15 | 15 | 15 | 15 | 0 | - +----------------------------+-------+------------------+---------+---------------+---------+ - | WIFI_RX_IRAM_OPT | 16 | 16 | 16 | 0 | 0 | - +----------------------------+-------+------------------+---------+---------------+---------+ - | LWIP_IRAM_OPTIMIZATION | 13 | 13 | 0 | 0 | 0 | - +----------------------------+-------+------------------+---------+---------------+---------+ - | INSTRUCTION_CACHE | 16 | 16 | 16 | 16 | 8 | - +----------------------------+-------+------------------+---------+---------------+---------+ - | INSTRUCTION_CACHE_LINE | 16 | 16 | 16 | 16 | 16 | +----------------------------+-------+------------------+---------+---------------+---------+ - | TCP TX throughput | 37.6 | 33.1 | 22.5 | 12.2 | 5.5 | + | WIFI_RX_IRAM_OPT | 16 | 16 | 16 | 0 | 0 | +----------------------------+-------+------------------+---------+---------------+---------+ - | TCP RX throughput | 31.5 | 28.1 | 20.1 | 13.1 | 7.2 | + | LWIP_IRAM_OPTIMIZATION | 13 | 13 | 0 | 0 | 0 | +----------------------------+-------+------------------+---------+---------------+---------+ - | UDP TX throughput | 58.1 | 57.3 | 28.1 | 22.6 | 8.7 | + | INSTRUCTION_CACHE | 16 | 16 | 16 | 16 | 8 | + +----------------------------+-------+------------------+---------+---------------+---------+ + | INSTRUCTION_CACHE_LINE | 16 | 16 | 16 | 16 | 16 | + +----------------------------+-------+------------------+---------+---------------+---------+ + | TCP TX throughput (Mbit/s) | 37.6 | 33.1 | 22.5 | 12.2 | 5.5 | + +----------------------------+-------+------------------+---------+---------------+---------+ + | TCP RX throughput (Mbit/s) | 31.5 | 28.1 | 20.1 | 13.1 | 7.2 | + +----------------------------+-------+------------------+---------+---------------+---------+ + | UDP TX throughput (Mbit/s) | 58.1 | 57.3 | 28.1 | 22.6 | 8.7 | + +----------------------------+-------+------------------+---------+---------------+---------+ + | UDP RX throughput (Mbit/s) | 78.1 | 66.7 | 65.3 | 53.8 | 28.5 | +----------------------------+-------+------------------+---------+---------------+---------+ - | UDP RX throughput | 78.1 | 66.7 | 65.3 | 53.8 | 28.5 | - +----------------------------+-------+------------------+---------+---------------+---------+ .. only:: esp32c3 @@ -2110,13 +2110,13 @@ The parameters not mentioned in the following table should be set to the default +----------------------------+-------+---------+---------+ | LWIP_IRAM_OPTIMIZATION | 13 | 13 | 0 | +----------------------------+-------+---------+---------+ - | TCP TX throughput | 38.1 | 27.2 | 20.4 | + | TCP TX throughput (Mbit/s) | 38.1 | 27.2 | 20.4 | +----------------------------+-------+---------+---------+ - | TCP RX throughput | 35.3 | 24.2 | 17.4 | + | TCP RX throughput (Mbit/s) | 35.3 | 24.2 | 17.4 | +----------------------------+-------+---------+---------+ - | UDP TX throughput | 40.6 | 38.9 | 34.1 | + | UDP TX throughput (Mbit/s) | 40.6 | 38.9 | 34.1 | +----------------------------+-------+---------+---------+ - | UDP RX throughput | 52.4 | 44.5 | 44.2 | + | UDP RX throughput (Mbit/s) | 52.4 | 44.5 | 44.2 | +----------------------------+-------+---------+---------+ .. only:: esp32 or esp32s2 @@ -2129,51 +2129,51 @@ The parameters not mentioned in the following table should be set to the default **Ranks:** - - **Iperf rank** + - **Iperf rank** {IDF_TARGET_NAME} extreme performance rank used to test extreme performance. - - **High-performance rank** + - **High-performance rank** The {IDF_TARGET_NAME}'s high-performance configuration rank, suitable for scenarios that the application occupies less memory and has high-performance requirements. In this rank, users can choose to use the RX prior rank or the TX prior rank according to the usage scenario. - - **Default rank** + - **Default rank** {IDF_TARGET_NAME}'s default configuration rank, the available memory, and performance are in balance. - - **Memory saving rank** + - **Memory saving rank** This rank is suitable for scenarios where the application requires a large amount of memory, and the transceiver performance will be reduced in this rank. - - **Minimum rank** + - **Minimum rank** This is the minimum configuration rank of {IDF_TARGET_NAME}. The protocol stack only uses the necessary memory for running. It is suitable for scenarios that have no requirement for performance and the application requires lots of space. .. only:: esp32s2 **Ranks:** - - **Iperf rank** + - **Iperf rank** {IDF_TARGET_NAME} extreme performance rank used to test extreme performance. - - **High-performance rank** + - **High-performance rank** The {IDF_TARGET_NAME}'s high-performance configuration rank, suitable for scenarios that the application occupies less memory and has high-performance requirements. - - **Default rank** + - **Default rank** {IDF_TARGET_NAME}'s default configuration rank, the available memory, and performance are in balance. - - **Memory saving rank** + - **Memory saving rank** This rank is suitable for scenarios where the application requires a large amount of memory, and the transceiver performance will be reduced in this rank. - - **Minimum rank** + - **Minimum rank** This is the minimum configuration rank of {IDF_TARGET_NAME}. The protocol stack only uses the necessary memory for running. It is suitable for scenarios that have no requirement for performance and the application requires lots of space. .. only:: esp32c3 **Ranks:** - - **Iperf rank** + - **Iperf rank** {IDF_TARGET_NAME} extreme performance rank used to test extreme performance. - - **Default rank** + - **Default rank** {IDF_TARGET_NAME}'s default configuration rank, the available memory, and performance are in balance. - - **Minimum rank** + - **Minimum rank** This is the minimum configuration rank of {IDF_TARGET_NAME}. The protocol stack only uses the necessary memory for running. It is suitable for scenarios that have no requirement for performance and the application requires lots of space. .. only:: esp32 or esp32s2 @@ -2184,84 +2184,84 @@ The parameters not mentioned in the following table should be set to the default PSRAM is generally used when the application takes up a lot of memory. In this mode, the :ref:`CONFIG_ESP32_WIFI_TX_BUFFER` is forced to be static. :ref:`CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM` indicates the number of DMA buffers at the hardware layer, increase this parameter can improve performance. The following are the recommended ranks for using PSRAM: -.. only:: esp32 + .. only:: esp32 - +----------------------------+-------+---------+---------------+---------+ - | Rank | Iperf | Default | Memory saving | Minimum | - +============================+=======+=========+===============+=========+ - | Available memory(KB) | 113.8 | 152.4 | 181.2 | 202.6 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_STATIC_RX_BUFFER_NUM | 16 | 8 | 4 | 2 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_DYNAMIC_RX_BUFFER_NUM | 128 | 128 | 128 | 128 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_STATIC_TX_BUFFER_NUM | 16 | 8 | 4 | 2 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_RX_BA_WIN | 16 | 16 | 8 | Disable | - +----------------------------+-------+---------+---------------+---------+ - | TCP_SND_BUF_DEFAULT(KB) | 65 | 65 | 65 | 65 | - +----------------------------+-------+---------+---------------+---------+ - | TCP_WND_DEFAULT(KB) | 65 | 65 | 65 | 65 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_IRAM_OPT | 15 | 15 | 15 | 0 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_RX_IRAM_OPT | 16 | 16 | 0 | 0 | - +----------------------------+-------+---------+---------------+---------+ - | LWIP_IRAM_OPTIMIZATION | 13 | 0 | 0 | 0 | - +----------------------------+-------+---------+---------------+---------+ - | TCP TX throughput | 37.5 | 31.7 | 21.7 | 14.6 | - +----------------------------+-------+---------+---------------+---------+ - | TCP RX throughput | 31.5 | 29.8 | 26.5 | 21.1 | - +----------------------------+-------+---------+---------------+---------+ - | UDP TX throughput | 69.1 | 31.5 | 27.1 | 24.1 | - +----------------------------+-------+---------+---------------+---------+ - | UDP RX throughput | 40.1 | 38.5 | 37.5 | 36.9 | - +----------------------------+-------+---------+---------------+---------+ + +----------------------------+-------+---------+---------------+---------+ + | Rank | Iperf | Default | Memory saving | Minimum | + +============================+=======+=========+===============+=========+ + | Available memory(KB) | 113.8 | 152.4 | 181.2 | 202.6 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_STATIC_RX_BUFFER_NUM | 16 | 8 | 4 | 2 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_DYNAMIC_RX_BUFFER_NUM | 128 | 128 | 128 | 128 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_STATIC_TX_BUFFER_NUM | 16 | 8 | 4 | 2 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_RX_BA_WIN | 16 | 16 | 8 | Disable | + +----------------------------+-------+---------+---------------+---------+ + | TCP_SND_BUF_DEFAULT(KB) | 65 | 65 | 65 | 65 | + +----------------------------+-------+---------+---------------+---------+ + | TCP_WND_DEFAULT(KB) | 65 | 65 | 65 | 65 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_IRAM_OPT | 15 | 15 | 15 | 0 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_RX_IRAM_OPT | 16 | 16 | 0 | 0 | + +----------------------------+-------+---------+---------------+---------+ + | LWIP_IRAM_OPTIMIZATION | 13 | 0 | 0 | 0 | + +----------------------------+-------+---------+---------------+---------+ + | TCP TX throughput (Mbit/s) | 37.5 | 31.7 | 21.7 | 14.6 | + +----------------------------+-------+---------+---------------+---------+ + | TCP RX throughput (Mbit/s) | 31.5 | 29.8 | 26.5 | 21.1 | + +----------------------------+-------+---------+---------------+---------+ + | UDP TX throughput (Mbit/s) | 69.1 | 31.5 | 27.1 | 24.1 | + +----------------------------+-------+---------+---------------+---------+ + | UDP RX throughput (Mbit/s) | 40.1 | 38.5 | 37.5 | 36.9 | + +----------------------------+-------+---------+---------------+---------+ -.. only:: esp32s2 + .. only:: esp32s2 - +----------------------------+-------+---------+---------------+---------+ - | Rank | Iperf | Default | Memory saving | Minimum | - +============================+=======+=========+===============+=========+ - | Available memory(KB) | 70.6 | 96.4 | 118.8 | 148.2 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_STATIC_RX_BUFFER_NUM | 8 | 8 | 6 | 4 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_DYNAMIC_RX_BUFFER_NUM | 64 | 64 | 64 | 64 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_STATIC_TX_BUFFER_NUM | 16 | 8 | 6 | 4 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_RX_BA_WIN | 16 | 6 | 6 | Disable | - +----------------------------+-------+---------+---------------+---------+ - | TCP_SND_BUF_DEFAULT(KB) | 32 | 32 | 32 | 32 | - +----------------------------+-------+---------+---------------+---------+ - | TCP_WND_DEFAULT(KB) | 32 | 32 | 32 | 32 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_IRAM_OPT | 15 | 15 | 15 | 0 | - +----------------------------+-------+---------+---------------+---------+ - | WIFI_RX_IRAM_OPT | 16 | 16 | 0 | 0 | - +----------------------------+-------+---------+---------------+---------+ - | LWIP_IRAM_OPTIMIZATION | 13 | 0 | 0 | 0 | - +----------------------------+-------+---------+---------------+---------+ - | INSTRUCTION_CACHE | 16 | 16 | 16 | 8 | - +----------------------------+-------+---------+---------------+---------+ - | INSTRUCTION_CACHE_LINE | 16 | 16 | 16 | 16 | - +----------------------------+-------+---------+---------------+---------+ - | DATA_CACHE | 8 | 8 | 8 | 8 | - +----------------------------+-------+---------+---------------+---------+ - | DATA_CACHE_LINE | 32 | 32 | 32 | 32 | - +----------------------------+-------+---------+---------------+---------+ - | TCP TX throughput | 40.1 | 29.2 | 20.1 | 8.9 | - +----------------------------+-------+---------+---------------+---------+ - | TCP RX throughput | 21.9 | 16.8 | 14.8 | 9.6 | - +----------------------------+-------+---------+---------------+---------+ - | UDP TX throughput | 50.1 | 25.7 | 22.4 | 10.2 | - +----------------------------+-------+---------+---------------+---------+ - | UDP RX throughput | 45.3 | 43.1 | 28.5 | 15.1 | - +----------------------------+-------+---------+---------------+---------+ - - .. note:: - Reaching peak performance may cause task watchdog. It is a normal phenomenon considering the CPU may have no time for lower priority tasks. + +----------------------------+-------+---------+---------------+---------+ + | Rank | Iperf | Default | Memory saving | Minimum | + +============================+=======+=========+===============+=========+ + | Available memory(KB) | 70.6 | 96.4 | 118.8 | 148.2 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_STATIC_RX_BUFFER_NUM | 8 | 8 | 6 | 4 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_DYNAMIC_RX_BUFFER_NUM | 64 | 64 | 64 | 64 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_STATIC_TX_BUFFER_NUM | 16 | 8 | 6 | 4 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_RX_BA_WIN | 16 | 6 | 6 | Disable | + +----------------------------+-------+---------+---------------+---------+ + | TCP_SND_BUF_DEFAULT(KB) | 32 | 32 | 32 | 32 | + +----------------------------+-------+---------+---------------+---------+ + | TCP_WND_DEFAULT(KB) | 32 | 32 | 32 | 32 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_IRAM_OPT | 15 | 15 | 15 | 0 | + +----------------------------+-------+---------+---------------+---------+ + | WIFI_RX_IRAM_OPT | 16 | 16 | 0 | 0 | + +----------------------------+-------+---------+---------------+---------+ + | LWIP_IRAM_OPTIMIZATION | 13 | 0 | 0 | 0 | + +----------------------------+-------+---------+---------------+---------+ + | INSTRUCTION_CACHE | 16 | 16 | 16 | 8 | + +----------------------------+-------+---------+---------------+---------+ + | INSTRUCTION_CACHE_LINE | 16 | 16 | 16 | 16 | + +----------------------------+-------+---------+---------------+---------+ + | DATA_CACHE | 8 | 8 | 8 | 8 | + +----------------------------+-------+---------+---------------+---------+ + | DATA_CACHE_LINE | 32 | 32 | 32 | 32 | + +----------------------------+-------+---------+---------------+---------+ + | TCP TX throughput (Mbit/s) | 40.1 | 29.2 | 20.1 | 8.9 | + +----------------------------+-------+---------+---------------+---------+ + | TCP RX throughput (Mbit/s) | 21.9 | 16.8 | 14.8 | 9.6 | + +----------------------------+-------+---------+---------------+---------+ + | UDP TX throughput (Mbit/s) | 50.1 | 25.7 | 22.4 | 10.2 | + +----------------------------+-------+---------+---------------+---------+ + | UDP RX throughput (Mbit/s) | 45.3 | 43.1 | 28.5 | 15.1 | + +----------------------------+-------+---------+---------------+---------+ + + .. note:: + Reaching peak performance may cause task watchdog. It is a normal phenomenon considering the CPU may have no time for lower priority tasks. Wi-Fi Menuconfig ----------------------- diff --git a/docs/zh_CN/api-guides/wifi.rst b/docs/zh_CN/api-guides/wifi.rst index ad94705cd6..fe4d238c4a 100644 --- a/docs/zh_CN/api-guides/wifi.rst +++ b/docs/zh_CN/api-guides/wifi.rst @@ -22,7 +22,7 @@ 准备工作 +++++++++++ -一般来说,要编写自己的 Wi-Fi 应用程序,最高效的方式是先选择一个相似的应用程序示例,然后将其中可用的部分移植到自己的项目中。如果您希望编写一个强健的 Wi-Fi 应用程序,强烈建议您在开始之前先阅读本文。**非强制要求,请依个人情况而定。** +一般来说,要编写自己的 Wi-Fi 应用程序,最高效的方式是先选择一个相似的应用程序示例,然后将其中可用的部分移植到自己的项目中。如果您希望编写一个强健的 Wi-Fi 应用程序,强烈建议您在开始之前先阅读本文。**非强制要求,请依个人情况而定。** 本文将补充说明 Wi-Fi API 和 Wi-Fi 示例的相关信息,重点描述使用 Wi-Fi API 的原则、当前 Wi-Fi API 实现的限制以及使用 Wi-Fi 时的常见错误。同时,本文还介绍了 Wi-Fi 驱动程序的一些设计细节。建议您选择一个示例 :example:`example ` 进行参考。 @@ -986,7 +986,7 @@ beacon 超时发生后,station 将向 AP 发送 5 个 probe request,如果 Wi-Fi 模式 +++++++++++++++++++++++++ -调用函数 :cpp:func:`esp_wifi_set_mode()` 设置 Wi-Fi 模式。 +调用函数 :cpp:func:`esp_wifi_set_mode()` 设置 Wi-Fi 模式。 +-----------------+------------------------------------------------------------------------------+ | 模式 | 描述 | @@ -1249,7 +1249,7 @@ Wi-Fi 国家/地区代码 | | | 连接一个 AP,该 AP 的国家/地区信息与该 station 相同。与 | | | | Station 模式、WIFI_COUNTRY_POLICY_AUTO 政策下使用的国家/地区信息相同。 | +---------------------+----------------------------+------------------------------------------------------------------------------+ - + 主信道 ************************* @@ -1398,7 +1398,7 @@ Wi-Fi 80211 数据包发送 - 发送非 QoS 数据帧。 不能用于发送加密或 QoS 帧。 - + 使用 :cpp:func:`esp_wifi_80211_tx` 的前提条件 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -1590,7 +1590,7 @@ Wi-Fi 信道状态信息 .. note :: - 对于 STBC 数据包,每个空时流都提供了 CSI,不会出现 CSD(循环移位延迟)。由于附加链上的每一次循环移位为 -200 ns,因为子载波 0 中没有信道频率响应,在 HT-LTF 和 STBC-HT-LTF 中只记录第一空时流的 CSD 角度。CSD[10:0] 是 11 位,范围从 -pi 到 pi。 - + - 如果调用 API :cpp:func:`esp_wifi_set_csi_config` 没有使能 LLTF、HT-LTF 或 STBC-HT-LTF,则 CSI 数据的总字节数会比表中的少。例如,如果没有使能 LLTF 和 HT-LTF,而使能 STBC-HT-LTF,当接收到上述条件、HT、40 MHz 或 STBC的数据包时,CSI 数据的总字节数为 244((61+60)*2+2=244,结果对齐为四个字节,最后两个字节无效)。 Wi-Fi 信道状态信息配置 @@ -1701,7 +1701,7 @@ Wi-Fi 驱动程序中默认的缓存类型是“动态”。大多数情况下 lwIP 还在 TCP/IP 层分配缓冲区,这种缓冲区分配也是动态的。具体内容,见 `lwIP 文档内存使用和性能部分 `_。 -Wi-Fi 动态缓冲区峰值 +Wi-Fi 动态缓冲区峰值 ++++++++++++++++++++++++++++++ Wi-Fi 驱动程序支持多种类型的缓冲区(参考 `Wi-Fi 缓冲区配置`_ )。但本节只介绍 Wi-Fi 动态缓冲的使用方法 @@ -1786,7 +1786,7 @@ Wi-Fi 使用的堆内存峰值是 Wi-Fi 驱动程序 **理论上消耗的最大 .. only:: esp32s2 - **缓存:** + **缓存:** - :ref:`CONFIG_ESP32S2_INSTRUCTION_CACHE_SIZE` 配置指令缓存的大小。 @@ -1831,13 +1831,13 @@ Wi-Fi 使用的堆内存峰值是 Wi-Fi 驱动程序 **理论上消耗的最大 +----------------------------+-------+--------------+--------+--------------+--------+----------+-------+ | LWIP_IRAM_OPTIMIZATION | 13 | 13 | 13 | 13 | 13 | 13 | 13 | +----------------------------+-------+--------------+--------+--------------+--------+----------+-------+ - | TCP 发送数据吞吐量 | 74.6 | 50.8 | 46.5 | 39.9 | 44.2 | 33.8 | 25.6 | + | TCP 发送数据吞吐量 (Mbit/s)| 74.6 | 50.8 | 46.5 | 39.9 | 44.2 | 33.8 | 25.6 | +----------------------------+-------+--------------+--------+--------------+--------+----------+-------+ - | TCP 接收数据吞吐量 | 63.6 | 35.5 | 42.3 | 48.5 | 40.5 | 30.1 | 27.8 | + | TCP 接收数据吞吐量 (Mbit/s)| 63.6 | 35.5 | 42.3 | 48.5 | 40.5 | 30.1 | 27.8 | +----------------------------+-------+--------------+--------+--------------+--------+----------+-------+ - | UDP 发送数据吞吐量 | 76.2 | 75.1 | 74.1 | 72.4 | 69.6 | 64.1 | 36.5 | + | UDP 发送数据吞吐量 (Mbit/s)| 76.2 | 75.1 | 74.1 | 72.4 | 69.6 | 64.1 | 36.5 | +----------------------------+-------+--------------+--------+--------------+--------+----------+-------+ - | UDP 接收数据吞吐量 | 83.1 | 66.3 | 75.1 | 75.6 | 73.1 | 65.3 | 54.7 | + | UDP 接收数据吞吐量 (Mbit/s)| 83.1 | 66.3 | 75.1 | 75.6 | 73.1 | 65.3 | 54.7 | +----------------------------+-------+--------------+--------+--------------+--------+----------+-------+ @@ -1870,13 +1870,13 @@ Wi-Fi 使用的堆内存峰值是 Wi-Fi 驱动程序 **理论上消耗的最大 +----------------------------+-------+--------+------+----------+-------+ | INSTRUCTION_CACHE_LINE | 16 | 16 | 16 | 16 | 16 | +----------------------------+-------+--------+------+----------+-------+ - | TCP 发送数据吞吐量 | 37.6 | 33.1 | 22.5 | 12.2 | 5.5 | + | TCP 发送数据吞吐量 (Mbit/s)| 37.6 | 33.1 | 22.5 | 12.2 | 5.5 | +----------------------------+-------+--------+------+----------+-------+ - | TCP 接收数据吞吐量 | 31.5 | 28.1 | 20.1 | 13.1 | 7.2 | + | TCP 接收数据吞吐量 (Mbit/s)| 31.5 | 28.1 | 20.1 | 13.1 | 7.2 | +----------------------------+-------+--------+------+----------+-------+ - | UDP 发送数据吞吐量 | 58.1 | 57.3 | 28.1 | 22.6 | 8.7 | + | UDP 发送数据吞吐量 (Mbit/s)| 58.1 | 57.3 | 28.1 | 22.6 | 8.7 | +----------------------------+-------+--------+------+----------+-------+ - | UDP 接收数据吞吐量 | 78.1 | 66.7 | 65.3 | 53.8 | 28.5 | + | UDP 接收数据吞吐量 (Mbit/s)| 78.1 | 66.7 | 65.3 | 53.8 | 28.5 | +----------------------------+-------+--------+------+----------+-------+ .. only:: esp32c3 @@ -1900,13 +1900,13 @@ Wi-Fi 使用的堆内存峰值是 Wi-Fi 驱动程序 **理论上消耗的最大 +----------------------------+-------+---------+---------+ | LWIP_IRAM_OPTIMIZATION | 13 | 13 | 0 | +----------------------------+-------+---------+---------+ - | TCP 发送数据吞吐量 | 38.1 | 27.2 | 20.4 | + | TCP 发送数据吞吐量 (Mbit/s)| 38.1 | 27.2 | 20.4 | +----------------------------+-------+---------+---------+ - | TCP 接收数据吞吐量 | 35.3 | 24.2 | 17.4 | + | TCP 接收数据吞吐量 (Mbit/s)| 35.3 | 24.2 | 17.4 | +----------------------------+-------+---------+---------+ - | UDP 发送数据吞吐量 | 40.6 | 38.9 | 34.1 | + | UDP 发送数据吞吐量 (Mbit/s)| 40.6 | 38.9 | 34.1 | +----------------------------+-------+---------+---------+ - | UDP 接收数据吞吐量 | 52.4 | 44.5 | 44.2 | + | UDP 接收数据吞吐量 (Mbit/s)| 52.4 | 44.5 | 44.2 | +----------------------------+-------+---------+---------+ .. note:: @@ -1917,51 +1917,51 @@ Wi-Fi 使用的堆内存峰值是 Wi-Fi 驱动程序 **理论上消耗的最大 **等级:** - - **Iperf 等级** + - **Iperf 等级** {IDF_TARGET_NAME} 的极端性能等级,用于测试极端性能。 - - **高性能等级** + - **高性能等级** {IDF_TARGET_NAME} 的高性能配置等级,适用于应用程序占用内存较少且有高性能要求的场景。在该等级中,您可以根据使用场景选择使用接收数据优先等级或发送数据优先等级。 - - **默认等级** + - **默认等级** IDF_TARGET_NAME} 的默认配置等级、兼顾可用内存和性能。 - - **节省内存等级** + - **节省内存等级** 该等级适用于应用程序需要大量内存的场景,在这一等级下,收发器的性能会有所降低。 - - **最小等级** + - **最小等级** {IDF_TARGET_NAME} 的最小配置等级。协议栈只使用运行所需的内存。适用于对性能没有要求,而应用程序需要大量内存的场景。 .. only:: esp32s2 **等级:** - - **Iperf 等级** + - **Iperf 等级** {IDF_TARGET_NAME} 极端性能等级,用于测试极端性能。 - - **高性能等级** + - **高性能等级** {IDF_TARGET_NAME} 的高性能配置等级,适用于应用程序占用内存较少且有高性能要求的场景。 - - **默认等级** + - **默认等级** IDF_TARGET_NAME} 的默认配置等级、兼顾可用内存和性能。 - - **节省内存等级** + - **节省内存等级** 该等级适用于应用程序需要大量内存的场景,在这一等级下,收发器的性能会有所降低。 - - **最小等级** + - **最小等级** {IDF_TARGET_NAME} 的最小配置等级。协议栈只使用运行所需的内存。适用于对性能没有要求,而应用程序需要大量内存的场景。 .. only:: esp32c3 **等级:** - - **Iperf 等级** + - **Iperf 等级** {IDF_TARGET_NAME} 极端性能等级,用于测试极端性能。 - - **默认等级** + - **默认等级** IDF_TARGET_NAME} 的默认配置等级、兼顾可用内存和性能。 - - **最小等级** + - **最小等级** {IDF_TARGET_NAME} 的最小配置等级。协议栈只使用运行所需的内存。适用于对性能没有要求,而应用程序需要大量内存的场景。 .. only:: esp32 or esp32s2 @@ -1972,81 +1972,81 @@ Wi-Fi 使用的堆内存峰值是 Wi-Fi 驱动程序 **理论上消耗的最大 PSRAM 一般在应用程序占用大量内存时使用。在该模式下,:ref:`CONFIG_ESP32_WIFI_TX_BUFFER` 被强制为静态。:ref:`CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM` 表示硬件层 DMA 缓冲区数量,提高这一参数可以增强性能。 我们推荐以下 PSRAM 等级。 -.. only:: esp32 + .. only:: esp32 - +----------------------------+-------+-------+----------+-------+ - | 等级 | Iperf | 默认 | 节省内存 | 最小 | - +----------------------------+-------+-------+----------+-------+ - | 可用内存 (KB) | 113.8 | 152.4 | 181.2 | 202.6 | - +----------------------------+-------+-------+----------+-------+ - | WIFI_STATIC_RX_BUFFER_NUM | 16 | 8 | 4 | 2 | - +----------------------------+-------+-------+----------+-------+ - | WIFI_DYNAMIC_RX_BUFFER_NUM | 128 | 128 | 128 | 128 | - +----------------------------+-------+-------+----------+-------+ - | WIFI_STATIC_TX_BUFFER_NUM | 16 | 8 | 4 | 2 | - +----------------------------+-------+-------+----------+-------+ - | WIFI_RX_BA_WIN | 16 | 16 | 8 | 禁用 | - +----------------------------+-------+-------+----------+-------+ - | TCP_SND_BUF_DEFAULT (KB) | 65 | 65 | 65 | 65 | - +----------------------------+-------+-------+----------+-------+ - | TCP_WND_DEFAULT (KB) | 65 | 65 | 65 | 65 | - +----------------------------+-------+-------+----------+-------+ - | WIFI_IRAM_OPT | 15 | 15 | 15 | 0 | - +----------------------------+-------+-------+----------+-------+ - | WIFI_RX_IRAM_OPT | 16 | 16 | 0 | 0 | - +----------------------------+-------+-------+----------+-------+ - | LWIP_IRAM_OPTIMIZATION | 13 | 0 | 0 | 0 | - +----------------------------+-------+-------+----------+-------+ - | TCP 发送数据吞吐量 | 37.5 | 31.7 | 21.7 | 14.6 | - +----------------------------+-------+-------+----------+-------+ - | TCP 接收数据吞吐量 | 31.5 | 29.8 | 26.5 | 21.1 | - +----------------------------+-------+-------+----------+-------+ - | UDP 发送数据吞吐量 | 69.1 | 31.5 | 27.1 | 24.1 | - +----------------------------+-------+-------+----------+-------+ - | UDP 接收数据吞吐量 | 40.1 | 38.5 | 37.5 | 36.9 | - +----------------------------+-------+-------+----------+-------+ + +----------------------------+-------+-------+----------+-------+ + | 等级 | Iperf | 默认 | 节省内存 | 最小 | + +----------------------------+-------+-------+----------+-------+ + | 可用内存 (KB) | 113.8 | 152.4 | 181.2 | 202.6 | + +----------------------------+-------+-------+----------+-------+ + | WIFI_STATIC_RX_BUFFER_NUM | 16 | 8 | 4 | 2 | + +----------------------------+-------+-------+----------+-------+ + | WIFI_DYNAMIC_RX_BUFFER_NUM | 128 | 128 | 128 | 128 | + +----------------------------+-------+-------+----------+-------+ + | WIFI_STATIC_TX_BUFFER_NUM | 16 | 8 | 4 | 2 | + +----------------------------+-------+-------+----------+-------+ + | WIFI_RX_BA_WIN | 16 | 16 | 8 | 禁用 | + +----------------------------+-------+-------+----------+-------+ + | TCP_SND_BUF_DEFAULT (KB) | 65 | 65 | 65 | 65 | + +----------------------------+-------+-------+----------+-------+ + | TCP_WND_DEFAULT (KB) | 65 | 65 | 65 | 65 | + +----------------------------+-------+-------+----------+-------+ + | WIFI_IRAM_OPT | 15 | 15 | 15 | 0 | + +----------------------------+-------+-------+----------+-------+ + | WIFI_RX_IRAM_OPT | 16 | 16 | 0 | 0 | + +----------------------------+-------+-------+----------+-------+ + | LWIP_IRAM_OPTIMIZATION | 13 | 0 | 0 | 0 | + +----------------------------+-------+-------+----------+-------+ + | TCP 发送数据吞吐量 (Mbit/s)| 37.5 | 31.7 | 21.7 | 14.6 | + +----------------------------+-------+-------+----------+-------+ + | TCP 接收数据吞吐量 (Mbit/s)| 31.5 | 29.8 | 26.5 | 21.1 | + +----------------------------+-------+-------+----------+-------+ + | UDP 发送数据吞吐量 (Mbit/s)| 69.1 | 31.5 | 27.1 | 24.1 | + +----------------------------+-------+-------+----------+-------+ + | UDP 接收数据吞吐量 (Mbit/s)| 40.1 | 38.5 | 37.5 | 36.9 | + +----------------------------+-------+-------+----------+-------+ -.. only:: esp32s2 + .. only:: esp32s2 - +----------------------------+-------+------+----------+-------+ - | 等级 | Iperf | 默认 | 节省内存 | 最小 | - +----------------------------+-------+------+----------+-------+ - | 可用内存 (KB) | 70.6 | 96.4 | 118.8 | 148.2 | - +----------------------------+-------+------+----------+-------+ - | WIFI_STATIC_RX_BUFFER_NUM | 8 | 8 | 6 | 4 | - +----------------------------+-------+------+----------+-------+ - | WIFI_DYNAMIC_RX_BUFFER_NUM | 64 | 64 | 64 | 64 | - +----------------------------+-------+------+----------+-------+ - | WIFI_STATIC_TX_BUFFER_NUM | 16 | 8 | 6 | 4 | - +----------------------------+-------+------+----------+-------+ - | WIFI_RX_BA_WIN | 16 | 6 | 6 | 禁用 | - +----------------------------+-------+------+----------+-------+ - | TCP_SND_BUF_DEFAULT (KB) | 32 | 32 | 32 | 32 | - +----------------------------+-------+------+----------+-------+ - | TCP_WND_DEFAULT (KB) | 32 | 32 | 32 | 32 | - +----------------------------+-------+------+----------+-------+ - | WIFI_IRAM_OPT | 15 | 15 | 15 | 0 | - +----------------------------+-------+------+----------+-------+ - | WIFI_RX_IRAM_OPT | 16 | 16 | 0 | 0 | - +----------------------------+-------+------+----------+-------+ - | LWIP_IRAM_OPTIMIZATION | 13 | 0 | 0 | 0 | - +----------------------------+-------+------+----------+-------+ - | INSTRUCTION_CACHE | 16 | 16 | 16 | 8 | - +----------------------------+-------+------+----------+-------+ - | INSTRUCTION_CACHE_LINE | 16 | 16 | 16 | 16 | - +----------------------------+-------+------+----------+-------+ - | DATA_CACHE | 8 | 8 | 8 | 8 | - +----------------------------+-------+------+----------+-------+ - | DATA_CACHE_LINE | 32 | 32 | 32 | 32 | - +----------------------------+-------+------+----------+-------+ - | TCP 发送数据吞吐量 | 40.1 | 29.2 | 20.1 | 8.9 | - +----------------------------+-------+------+----------+-------+ - | TCP 接收数据吞吐量 | 21.9 | 16.8 | 14.8 | 9.6 | - +----------------------------+-------+------+----------+-------+ - | UDP 发送数据吞吐量 | 50.1 | 25.7 | 22.4 | 10.2 | - +----------------------------+-------+------+----------+-------+ - | UDP 接收数据吞吐量 | 45.3 | 43.1 | 28.5 | 15.1 | - +----------------------------+-------+------+----------+-------+ + +----------------------------+-------+------+----------+-------+ + | 等级 | Iperf | 默认 | 节省内存 | 最小 | + +----------------------------+-------+------+----------+-------+ + | 可用内存 (KB) | 70.6 | 96.4 | 118.8 | 148.2 | + +----------------------------+-------+------+----------+-------+ + | WIFI_STATIC_RX_BUFFER_NUM | 8 | 8 | 6 | 4 | + +----------------------------+-------+------+----------+-------+ + | WIFI_DYNAMIC_RX_BUFFER_NUM | 64 | 64 | 64 | 64 | + +----------------------------+-------+------+----------+-------+ + | WIFI_STATIC_TX_BUFFER_NUM | 16 | 8 | 6 | 4 | + +----------------------------+-------+------+----------+-------+ + | WIFI_RX_BA_WIN | 16 | 6 | 6 | 禁用 | + +----------------------------+-------+------+----------+-------+ + | TCP_SND_BUF_DEFAULT (KB) | 32 | 32 | 32 | 32 | + +----------------------------+-------+------+----------+-------+ + | TCP_WND_DEFAULT (KB) | 32 | 32 | 32 | 32 | + +----------------------------+-------+------+----------+-------+ + | WIFI_IRAM_OPT | 15 | 15 | 15 | 0 | + +----------------------------+-------+------+----------+-------+ + | WIFI_RX_IRAM_OPT | 16 | 16 | 0 | 0 | + +----------------------------+-------+------+----------+-------+ + | LWIP_IRAM_OPTIMIZATION | 13 | 0 | 0 | 0 | + +----------------------------+-------+------+----------+-------+ + | INSTRUCTION_CACHE | 16 | 16 | 16 | 8 | + +----------------------------+-------+------+----------+-------+ + | INSTRUCTION_CACHE_LINE | 16 | 16 | 16 | 16 | + +----------------------------+-------+------+----------+-------+ + | DATA_CACHE | 8 | 8 | 8 | 8 | + +----------------------------+-------+------+----------+-------+ + | DATA_CACHE_LINE | 32 | 32 | 32 | 32 | + +----------------------------+-------+------+----------+-------+ + | TCP 发送数据吞吐量 (Mbit/s)| 40.1 | 29.2 | 20.1 | 8.9 | + +----------------------------+-------+------+----------+-------+ + | TCP 接收数据吞吐量 (Mbit/s)| 21.9 | 16.8 | 14.8 | 9.6 | + +----------------------------+-------+------+----------+-------+ + | UDP 发送数据吞吐量 (Mbit/s)| 50.1 | 25.7 | 22.4 | 10.2 | + +----------------------------+-------+------+----------+-------+ + | UDP 接收数据吞吐量 (Mbit/s)| 45.3 | 43.1 | 28.5 | 15.1 | + +----------------------------+-------+------+----------+-------+