doc: esp32c2 wifi programming guide doc.

This commit is contained in:
Mu Hai Dong
2022-07-07 14:13:11 +08:00
committed by morris
parent 0d86ca59a6
commit eb4421bf33
11 changed files with 512 additions and 333 deletions

View File

@@ -111,7 +111,9 @@ ESP32_DOCS = ['api-reference/system/himem.rst',
'api-reference/peripherals/secure_element.rst',
'api-reference/peripherals/dac.rst',
'hw-reference/esp32/**',
'api-guides/RF_calibration.rst'] + FTDI_JTAG_DOCS
'api-guides/RF_calibration.rst',
'api-guides/esp-wifi-mesh.rst',
'api-reference/network/esp-wifi-mesh.rst'] + FTDI_JTAG_DOCS
ESP32S2_DOCS = ['hw-reference/esp32s2/**',
'api-guides/usb-console.rst',
@@ -120,16 +122,22 @@ ESP32S2_DOCS = ['hw-reference/esp32s2/**',
'api-reference/peripherals/temp_sensor.rst',
'api-reference/system/async_memcpy.rst',
'api-reference/peripherals/touch_element.rst',
'api-guides/RF_calibration.rst'] + FTDI_JTAG_DOCS
'api-guides/RF_calibration.rst',
'api-guides/esp-wifi-mesh.rst',
'api-reference/network/esp-wifi-mesh.rst'] + FTDI_JTAG_DOCS
ESP32S3_DOCS = ['hw-reference/esp32s3/**',
'api-reference/system/ipc.rst',
'api-guides/flash_psram_config.rst',
'api-guides/RF_calibration.rst']
'api-guides/RF_calibration.rst',
'api-guides/esp-wifi-mesh.rst',
'api-reference/network/esp-wifi-mesh.rst']
# No JTAG docs for this one as it gets gated on SOC_USB_SERIAL_JTAG_SUPPORTED down below.
ESP32C3_DOCS = ['hw-reference/esp32c3/**',
'api-guides/RF_calibration.rst']
'api-guides/RF_calibration.rst',
'api-guides/esp-wifi-mesh.rst',
'api-reference/network/esp-wifi-mesh.rst']
# format: {tag needed to include: documents to included}, tags are parsed from sdkconfig and peripheral_caps.h headers
conditional_include_dict = {'SOC_BT_SUPPORTED':BT_DOCS,

View File

@@ -38,11 +38,9 @@ api-guides/lwip
api-guides/flash_psram_config
api-guides/usb-serial-jtag-console
api-guides/linker-script-generation
api-guides/wifi
api-guides/usb-otg-console
api-guides/wireshark-user-guide
api-guides/bootloader
api-guides/esp-wifi-mesh
api-guides/ulp-legacy
api-guides/build-system
api-guides/freertos-smp
@@ -93,9 +91,7 @@ api-reference/network/esp_netif_driver
api-reference/network/tcpip_adapter_migration
api-reference/network/esp_dpp
api-reference/network/esp_now
api-reference/network/esp-wifi-mesh
api-reference/network/esp_smartconfig
api-reference/network/esp_wifi
api-reference/network/index
api-reference/network/esp_netif
api-reference/system/sleep_modes

View File

@@ -16,9 +16,11 @@ Please see the :doc:`ble-mesh-architecture` for information about the implementa
ESP-BLE-MESH is implemented and certified based on the latest Mesh Profile v1.0.1, users can refer `here <https://launchstudio.bluetooth.com/ListingDetails/94304>`_ for the certification details of ESP-BLE-MESH.
.. only:: SOC_WIFI_MESH_SUPPORT
.. note::
If you are looking for Wi-Fi based implementation of mesh for {IDF_TARGET_NAME}, please check another product by Espressif called ESP-WIF-MESH. For more information and documentation see :doc:`ESP-WIFI-MESH <../../api-reference/network/esp-wifi-mesh>`.
If you are looking for Wi-Fi based implementation of mesh for {IDF_TARGET_NAME}, please check another product by Espressif called ESP-WIFI-MESH. For more information and documentation see :doc:`ESP-WIFI-MESH <../../api-reference/network/esp-wifi-mesh>`.
.. _getting-started-with-ble-mesh:

View File

@@ -127,11 +127,14 @@ Event IDs and Corresponding Data Structures
| (SYSTEM_EVENT_ETH_LOST_IP) | |
+------------------------------------+-----------------------------------------------+
.. only:: SOC_WIFI_MESH_SUPPORT
Mesh Events
-----------
ESP-WIFI-MESH uses a system similar to the :ref:`legacy-event-loop` to deliver events to the application. See :ref:`mesh-events` for details.
Bluetooth Events
----------------

View File

@@ -16,7 +16,7 @@ API Guides
error-handling
:SOC_BT_SUPPORTED: esp-ble-mesh/ble-mesh-index
freertos-smp
esp-wifi-mesh
:SOC_WIFI_MESH_SUPPORT: esp-wifi-mesh
event-handling
fatal-errors
../security/flash-encryption

View File

@@ -5,18 +5,36 @@ Wi-Fi Driver
{IDF_TARGET_NAME} Wi-Fi Feature List
------------------------------------
- Support 4 virtual WiFi interfaces, which are STA, AP, Sniffer and reserved.
- Support station-only mode, AP-only mode, station/AP-coexistence mode
- Support IEEE 802.11b, IEEE 802.11g, IEEE 802.11n, and APIs to configure the protocol mode
- Support WPA/WPA2/WPA3/WPA2-Enterprise and WPS
- Support AMPDU, HT40, QoS, and other key features
- Support Modem-sleep
- Support the Espressif-specific ESP-NOW protocol and Long Range mode, which supports up to **1 km** of data traffic
The following features are supported:
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
- 4 virtual Wi-Fi interfaces, which are STA, AP, Sniffer and reserved.
- Station-only mode, AP-only mode, station/AP-coexistence mode
- IEEE 802.11b, IEEE 802.11g, IEEE 802.11n, and APIs to configure the protocol mode
- WPA/WPA2/WPA3/WPA2-Enterprise/WPA3-Enterprise/WAPI/WPS and DPP
- AMSDU, AMPDU, HT40, QoS, and other key features
- Modem-sleep
- The Espressif-specific ESP-NOW protocol and Long Range mode, which supports up to **1 km** of data traffic
- Up to 20 MBit/s TCP throughput and 30 MBit/s UDP throughput over the air
- Support Sniffer
- Support both fast scan and all-channel scan
- Support multiple antennas
- Support channel state information
- Sniffer
- Both fast scan and all-channel scan
- Multiple antennas
- Channel state information
.. only:: esp32c2
- 3 virtual Wi-Fi interfaces, which are STA, AP and Sniffer.
- Station-only mode, AP-only mode, station/AP-coexistence mode
- IEEE 802.11b, IEEE 802.11g, IEEE 802.11n, and APIs to configure the protocol mode
- WPA/WPA2/WPA3/WPA2-Enterprise/WPA3-Enterprise/WPS and DPP
- AMSDU, AMPDU, QoS, and other key features
- Modem-sleep
- Up to 20 MBit/s TCP throughput and 30 MBit/s UDP throughput over the air
- Sniffer
- Both fast scan and all-channel scan
- Multiple antennas
How To Write a Wi-Fi Application
----------------------------------
@@ -1099,6 +1117,8 @@ AP Basic Configuration
API esp_wifi_set_config() can be used to configure the AP. The table below describes the fields in detail.
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
.. list-table::
:header-rows: 1
:widths: 15 55
@@ -1123,11 +1143,39 @@ API esp_wifi_set_config() can be used to configure the AP. The table below descr
- Beacon interval; the value is 100 ~ 60000 ms, with default value being 100 ms. If the value is out of range, AP defaults it to 100 ms.
.. only:: esp32c2
.. list-table::
:header-rows: 1
:widths: 15 55
* - Field
- Description
* - ssid
- SSID of AP; if the ssid[0] is 0xFF and ssid[1] is 0xFF, the AP defaults the SSID to ESP_aabbcc, where “aabbcc” is the last three bytes of the AP MAC.
* - password
- Password of AP; if the auth mode is WIFI_AUTH_OPEN, this field will be ignored.
* - ssid_len
- Length of SSID; if ssid_len is 0, check the SSID until there is a termination character. If ssid_len > 32, change it to 32; otherwise, set the SSID length according to ssid_len.
* - channel
- Channel of AP; if the channel is out of range, the Wi-Fi driver defaults the channel to channel 1. So, please make sure the channel is within the required range. For more details, refer to `Wi-Fi Country Code`_.
* - authmode
- Auth mode of ESP AP; currently, ESP Wi-Fi does not support AUTH_WEP. If the authmode is an invalid value, AP defaults the value to WIFI_AUTH_OPEN.
* - ssid_hidden
- If ssid_hidden is 1, AP does not broadcast the SSID; otherwise, it does broadcast the SSID.
* - max_connection
- Currently, ESP Wi-Fi supports up to 4 Wi-Fi connections. If max_connection > 4, AP defaults the value to 4.
* - beacon_interval
- Beacon interval; the value is 100 ~ 60000 ms, with default value being 100 ms. If the value is out of range, AP defaults it to 100 ms.
Wi-Fi Protocol Mode
+++++++++++++++++++++++++
Currently, the ESP-IDF supports the following protocol modes:
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
.. list-table::
:header-rows: 1
:widths: 15 55
@@ -1152,6 +1200,30 @@ Currently, the ESP-IDF supports the following protocol modes:
**This mode is an Espressif-patented mode which can achieve a one-kilometer line of sight range. Please make sure both the station and the AP are connected to an ESP device.**
.. only:: esp32c2
.. list-table::
:header-rows: 1
:widths: 15 55
* - Protocol Mode
- Description
* - 802.11b
- Call esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B) to set the station/AP to 802.11b-only mode.
* - 802.11bg
- Call esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G) to set the station/AP to 802.11bg mode.
* - 802.11g
- Call esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G) and esp_wifi_config_11b_rate(ifx, true) to set the station/AP to 802.11g mode.
* - 802.11bgn
- Call esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B| WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N) to set the station/ AP to BGN mode.
* - 802.11gn
- Call esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N) and esp_wifi_config_11b_rate(ifx, true) to set the station/AP to 802.11gn mode.
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
Long Range (LR)
+++++++++++++++++++++++++
@@ -1221,6 +1293,7 @@ The general conditions for using LR are:
- Long distance Wi-Fi connection and data transmission is required.
- Data throughput requirements are very small, such as remote device control.
Wi-Fi Country Code
+++++++++++++++++++++++++
@@ -1756,6 +1829,8 @@ Generally, following steps can be taken to configure the multiple antennas:
.enabled_ant1 = 3
};
.. only:: SOC_WIFI_CSI_SUPPORT
Wi-Fi Channel State Information
------------------------------------
@@ -1823,6 +1898,8 @@ The CSI receiving callback function runs from Wi-Fi task. So, do not do lengthy
Wi-Fi HT20/40
-------------------------
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
{IDF_TARGET_NAME} supports Wi-Fi bandwidth HT20 or HT40 and does not support HT20/40 coexist. :cpp:func:`esp_wifi_set_bandwidth()` can be used to change the default bandwidth of station or AP. The default bandwidth for {IDF_TARGET_NAME} station and AP is HT40.
In station mode, the actual bandwidth is firstly negotiated during the Wi-Fi connection. It is HT40 only if both the station and the connected AP support HT40, otherwise it is HT20. If the bandwidth of connected AP is changes, the actual bandwidth is negotiated again without Wi-Fi disconnecting.
@@ -1833,6 +1910,10 @@ In station/AP coexist mode, the station/AP can configure HT20/40 seperately. If
Theoretically, the HT40 can gain better throughput because the maximum raw physicial (PHY) data rate for HT40 is 150 Mbps while it is 72 Mbps for HT20. However, if the device is used in some special environment, e.g., there are too many other Wi-Fi devices around the {IDF_TARGET_NAME} device, the performance of HT40 may be degraded. So if the applications need to support same or similar scenarios, it is recommended that the bandwidth is always configured to HT20.
.. only:: esp32c2
{IDF_TARGET_NAME} supports Wi-Fi bandwidth HT20 and does not support Wi-Fi bandwidth HT40 or HT20/40 coexist.
Wi-Fi QoS
-------------------------

View File

@@ -10,16 +10,19 @@ Wi-Fi
:maxdepth: 1
esp_now
esp-wifi-mesh
:SOC_WIFI_MESH_SUPPORT: esp-wifi-mesh
esp_smartconfig
esp_wifi
esp_dpp
Code examples for the Wi-Fi API are provided in the :example:`wifi` directory of ESP-IDF examples.
.. only:: SOC_WIFI_MESH_SUPPORT
Code examples for ESP-WIFI-MESH are provided in the :example:`mesh` directory of ESP-IDF examples.
Ethernet
========

View File

@@ -19,10 +19,13 @@ ESP-BLE-MESH 基于 Zephyr 蓝牙 Mesh 协议栈的顶端,其实现支持设
ESP-BLE-MESH 的实现和认证基于最新的 `Mesh Profile v1.0.1 <https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=457092>`_ 。有关 ESP-BLE-MESH 认证的细节,请参考 `此处 <https://launchstudio.bluetooth.com/ListingDetails/94304>`_
.. only:: SOC_WIFI_MESH_SUPPORT
.. note::
如果您在寻找 ESP32 基于 Wi-Fi 的 mesh 方案,请查阅乐鑫的另一款产品 ESP-WIFI-MESH。更多相关信息及文档请参见 :doc:`ESP-WIFI-MESH <../../api-reference/network/esp-wifi-mesh>`
.. _getting-started-with-ble-mesh:
ESP-BLE-MESH 快速入门

View File

@@ -16,7 +16,7 @@ API 指南
error-handling
:SOC_BT_SUPPORTED: esp-ble-mesh/ble-mesh-index
freertos-smp
esp-wifi-mesh
:SOC_WIFI_MESH_SUPPORT: esp-wifi-mesh
event-handling
fatal-errors
../security/flash-encryption

View File

@@ -5,11 +5,13 @@
{IDF_TARGET_NAME} Wi-Fi 功能列表
------------------------------------
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
- 支持 4 个虚拟接口即STA、AP、Sniffer 和 reserved。
- 支持仅 station 模式、仅 AP 模式、station/AP 共存模式
- 支持使用 IEEE 802.11b、IEEE 802.11g、IEEE 802.11n 和 API 配置协议模式
- 支持 WPA/WPA2/WPA3/WPA2-企业版和 WPS
- 支持 AMPDU、HT40、QoS 以及其它主要功能
- 支持 WPA/WPA2/WPA3/WPA2-企业版/WPA3-企业版/WAPI/WPS 和 DPP
- 支持 AMSDU、AMPDU、HT40、QoS 以及其它主要功能
- 支持 Modem-sleep
- 支持乐鑫专属协议,可实现 **1 km** 数据通信量
- 空中数据传输最高可达 20 MBit/s TCP 吞吐量和 30 MBit/s UDP 吞吐量
@@ -18,6 +20,20 @@
- 支持多个天线
- 支持获取信道状态信息
.. only:: esp32c2
- 支持 3 个虚拟接口即STA、AP 和 Sniffer。
- 支持仅 station 模式、仅 AP 模式、station/AP 共存模式
- 支持使用 IEEE 802.11b、IEEE 802.11g、IEEE 802.11n 和 API 配置协议模式
- 支持 WPA/WPA2/WPA3/WPA2-企业版/WPA3-企业版/WPS 和 DPP
- 支持 AMSDU、AMPDU、QoS 以及其它主要功能
- 支持 Modem-sleep
- 空中数据传输最高可达 20 MBit/s TCP 吞吐量和 30 MBit/s UDP 吞吐量
- 支持 Sniffer
- 支持快速扫描和全信道扫描
- 支持多个天线
如何编写 Wi-Fi 应用程序
----------------------------------
@@ -1099,6 +1115,8 @@ AP 基本配置
API esp_wifi_set_config() 可用于配置 AP。下表详细介绍了各个字段。
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
.. list-table::
:header-rows: 1
:widths: 15 55
@@ -1123,11 +1141,40 @@ API esp_wifi_set_config() 可用于配置 AP。下表详细介绍了各个字段
- beacon 间隔。值为 100 ~ 60000 ms默认值为 100 ms。如果该值不在上述范围AP 默认取 100 ms。
.. only:: esp32c2
.. list-table::
:header-rows: 1
:widths: 15 55
* - 字段
- 描述
* - ssid
- 指 AP 的 SSID。如果 ssid[0] 和 ssid[1] 均为 0xFFAP 默认 SSID 为 ESP_aabbcc”aabbcc” 是 AP MAC 的最后三个字节。
* - password
- AP 的密码。如果身份验证模式为 WIFI_AUTH_OPEN此字段将被忽略。
* - ssid_len
- SSID 的长度。如果 ssid_len 为 0则检查 SSID 直至出现终止字符。如果 ssid_len 大于 32请更改为 32或者根据 ssid_len 设置 SSID 长度。
* - channel
- AP 的信道。如果信道超出范围Wi-Fi 驱动程序将默认该信道为信道 1。所以请确保信道在要求的范围内。有关详细信息请参阅 `Wi-Fi 国家/地区代码`_
* - authmode
- ESP AP 的身份验证模式。目前ESP Wi-Fi 不支持 AUTH_WEP。如果 authmode 是一个无效值AP 默认该值为 WIFI_AUTH_OPEN。
* - ssid_hidden
- 如果 ssid_hidden 为 1AP 不广播 SSID。若为其他值则广播。
* - max_connection
- 目前ESP Wi-Fi 支持 4 个 Wi-Fi 连接。如果 max_connection 大于 4AP 默认该值为 4。
* - beacon_interval
- beacon 间隔。值为 100 ~ 60000 ms默认值为 100 ms。如果该值不在上述范围AP 默认取 100 ms。
Wi-Fi 协议模式
+++++++++++++++++++++++++
目前IDF 支持以下协议模式:
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
.. list-table::
:header-rows: 1
:widths: 15 55
@@ -1152,6 +1199,30 @@ Wi-Fi 协议模式
**此模式是乐鑫的专利模式,可以达到 1 公里视线范围。请确保 station 和 AP 同时连接至 ESP 设备。**
.. only:: esp32c2
.. list-table::
:header-rows: 1
:widths: 15 55
* - 协议模式
- 描述
* - 802.11b
- 调用函数 esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B),将 station/AP 设置为仅 802.11b 模式。
* - 802.11bg
- 调用函数 esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G),将 station/AP 设置为 802.11bg 模式。
* - 802.11g
- 调用函数 esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G) 和 esp_wifi_config_11b_rate(ifx, true),将 station/AP 设置为 802.11g 模式。
* - 802.11bgn
- 调用函数 esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N),将 station/AP 设置为 802.11bgn 模式。
* - 802.11gn
- 调用函数 esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N) 和 esp_wifi_config_11b_rate(ifx, true),将 station/AP 设置为 802.11gn 模式。
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
长距离 (LR)
+++++++++++++++++++++++++
@@ -1221,6 +1292,7 @@ LR 吞吐量
- 需要长距离 Wi-Fi 连接和数据传输。
- 数据吞吐量要求非常小,例如远程设备控制等。
Wi-Fi 国家/地区代码
+++++++++++++++++++++++++
@@ -1756,6 +1828,8 @@ Wi-Fi 多根天线配置
.enabled_ant1 = 3
};
.. only:: SOC_WIFI_CSI_SUPPORT
Wi-Fi 信道状态信息
------------------------------------
@@ -1823,6 +1897,8 @@ CSI 接收回调函数从 Wi-Fi 任务中运行。因此,不要在回调函数
Wi-Fi HT20/40
-------------------------
.. only:: esp32 or esp32s2 or esp32c3 or esp32s3
{IDF_TARGET_NAME} 支持 Wi-Fi 带宽 HT20 或 HT40不支持 HT20/40 共存,调用函数 :cpp:func:`esp_wifi_set_bandwidth()` 可改变 station/AP 的默认带宽。{IDF_TARGET_NAME} station 和 AP 的默认带宽为 HT40。
station 模式下,实际带宽首先在 Wi-Fi 连接时协商。只有当 station 和所连 AP 都支持 HT40 时,带宽才为 HT40否则为 HT20。如果所连的 AP 的带宽发生变化,则在不断开 Wi-Fi 连接的情况下再次协商实际带宽。
@@ -1833,6 +1909,10 @@ station 模式下,实际带宽首先在 Wi-Fi 连接时协商。只有当 stat
理论上HT40 可以获得更大的吞吐量,因为 HT40 的最大原始 PHY 数据速率为 150 Mbps而 HT20 为 72 Mbps。但是如果设备在某些特殊环境中使用例如{IDF_TARGET_NAME} 周围其他 Wi-Fi 设备过多HT40 的性能可能会降低。因此,如果应用程序需要支持相同或类似的情况,建议始终将带宽配置为 HT20。
.. only:: esp32c2
{IDF_TARGET_NAME} 仅支持 Wi-Fi 带宽 HT20不支持 Wi-Fi 带宽 HT40 或 HT20/40 共存。
Wi-Fi QoS
-------------------------

View File

@@ -10,16 +10,19 @@ Wi-Fi
:maxdepth: 1
esp_now
esp-wifi-mesh
:SOC_WIFI_MESH_SUPPORT: esp-wifi-mesh
esp_smartconfig
esp_wifi
esp_dpp
本部分的 Wi-Fi API 示例代码存放在 ESP-IDF 示例项目的 :example:`wifi` 目录下。
.. only:: SOC_WIFI_MESH_SUPPORT
ESP-WIFI-MESH 的示例代码存放在 ESP-IDF 示例项目的 :example:`mesh` 目录下。
以太网
========