EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1560 background imageLoading...
Page #1560 background image
Chapter 4. API Guides
The ESP32-S2 protocol stack is divided into four layers: Application, LWIP, Wi-Fi, and Hardware.
During receiving, hardware puts the received packet into DMA buffer, and then transfers it into the RX buffer
of Wi-Fi, LWIP in turn for related protocol processing, and nally to the application layer. The Wi-Fi RX
buffer and the LWIP RX buffer shares the same buffer by default. In other words, the Wi-Fi forwards the
packet to LWIP by reference by default.
During sending, the application copies the messages to be sent into the TX buffer of the LWIP layer for TCP/IP
encapsulation. The messages will then be passed to the TX buffer of the Wi-Fi layer for MAC encapsulation
and wait to be sent.
Parameters
Increasing the size or number of the buffers mentioned above properly can improve Wi-Fi performance. Meanwhile,
it will reduce available memory to the application. The following is an introduction to the parameters that users need
to configure:
RX direction:
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM This parameter indicates the number of DMA buffer
at the hardware layer. Increasing this parameter will increase the senders one-time receiving throughput,
thereby improving the Wi-Fi protocol stack ability to handle burst traffic.
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM This parameter indicates the number of RX buffer
in the Wi-Fi layer. Increasing this parameter will improve the performance of packet reception. This
parameter needs to match the RX buffer size of the LWIP layer.
CONFIG_ESP32_WIFI_RX_BA_WIN This parameter indicates the size of the AMPDU BA
Window at the receiving end. This parameter should be configured to the smaller
value between twice of CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM and CON-
FIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM.
CONFIG_LWIP_TCP_WND_DEFAULT This parameter represents the RX buffer size of the
LWIP layer for each TCP stream. Its value should be configured to the value of
WIFI_DYNAMIC_RX_BUFFER_NUM(KB) to reach a high and stable performance. Meanwhile, in
case of multiple streams, this value needs to be reduced proportionally.
TX direction:
CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM This parameter indicates the type of TX buffer, it is
recommended to configure it as a dynamic buffer, which can make full use of memory.
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM This parameter indicates the number of TX buffer
on the Wi-Fi layer. Increasing this parameter will improve the performance of packet sending. The
parameter value needs to match the TX buffer size of the LWIP layer.
CONFIG_LWIP_TCP_SND_BUF_DEFAULT This parameter represents the TX buffer size of
the LWIP layer for each TCP stream. Its value should be configured to the value of
WIFI_DYNAMIC_TX_BUFFER_NUM(KB) to reach a high and stable performance. In case of
multiple streams, this value needs to be reduced proportionally.
Throughput optimization by placing code in IRAM:
CONFIG_ESP32_WIFI_IRAM_OPT If this option is enabled, some Wi-Fi functions are moved to IRAM,
improving throughput. This increases IRAM usage by 15 kB.
CONFIG_ESP32_WIFI_RX_IRAM_OPT If this option is enabled, some Wi-Fi RX functions are moved to
IRAM, improving throughput. This increases IRAM usage by 16 kB.
CONFIG_LWIP_IRAM_OPTIMIZATION If this option is enabled, some LWIP functions are moved to
IRAM, improving throughput. This increases IRAM usage by 13 kB.
CACHE:
CONFIG_ESP32S2_INSTRUCTION_CACHE_SIZE Configure the size of the instruction Cache.
CONFIG_ESP32S2_INSTRUCTION_CACHE_LINE_SIZE Configure the width of the instruction Cache bus.
Note: The buffer size mentioned above is fixed as 1.6 KB.
Espressif Systems 1549
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish