Merge branch 'feat/hosted_in_iperf' into 'master'

feat(hosted_in_iperf): Adds esp_hosted for P4

See merge request espressif/esp-idf!32459
This commit is contained in:
Jiang Jiang Jian
2025-02-12 11:50:32 +08:00
4 changed files with 97 additions and 4 deletions

View File

@@ -10,8 +10,8 @@ The iperf example doesn't support all features in standard iperf. It's compatibl
## 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.
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/).
@@ -76,3 +76,69 @@ The console output, which is printed by station TCP RX throughput test, looks li
Steps to test station/soft-AP TCP/UDP RX/TX throughput are similar as test steps in station TCP TX.
See the README.md file in the upper level 'examples' directory for more information about examples.
## ESP Chips without Native Wi-Fi
Some ESP chips like the ESP32-P4 or ESP32-H2, without built-in Wi-Fi or Bluetooth, can still use these features through a **two-chip solution** via ESP-Hosted. The host chip, when connected to a ESP chip as a Wi-Fi co-processor, can invoke Wi-Fi APIs over a communication bus like SPI or SDIO.
The two chip solution needs:
- Communication bus like SDIO or SPI between the host and co-processor
- Co-processor flashed with ESP-Hosted co-processor (slave) software
- Host processor flashed with additional software components: [esp-hosted](https://components.espressif.com/components/espressif/esp_hosted/) and [esp-wifi-remote](https://components.espressif.com/components/espressif/esp_wifi_remote/)
### Running iperf on the ESP32-P4-Function-EV-Board
On this board,
* The ESP32-P4 is already connected with the on-board ESP32-C6 (co-processor) using SDIO communication bus. See this ESP-Hosted EV Board [documentation](https://github.com/espressif/esp-hosted-mcu/blob/main/docs/esp32_p4_function_ev_board.md) for more information.
* The ESP32-C6 is pre-flashed with ESP-Hosted slave software.
* Optionally, you can re-flash the ESP32-C6 using [ESP-Hosted Slave Flashing Steps](https://github.com/espressif/esp-hosted-mcu/blob/main/docs/esp32_p4_function_ev_board.md#5-flashing-esp32-c6)
* Only the example code on the Host needs to be built & flashed using the steps below.
#### Host Flashing Steps
* Set the ESP32-P4 as the target
```sh
idf.py set-target esp32p4
```
You may see lines similar to this:
```
NOTICE: Processing 11 dependencies:
NOTICE: [1/11] cmd_system (*) (/home/esp/esp-idf/examples/system/console/advanced/components/cmd_system)
NOTICE: [2/11] esp-qa/ping-cmd (1.0.0)
NOTICE: [3/11] esp-qa/wifi-cmd (0.1.10)
NOTICE: [4/11] espressif/eppp_link (0.2.0)
NOTICE: [5/11] espressif/esp-extconn (0.1.0)
NOTICE: [6/11] espressif/esp_hosted (1.1.1)
NOTICE: [7/11] espressif/esp_serial_slave_link (1.1.0)
NOTICE: [8/11] espressif/esp_wifi_remote (0.5.3)
NOTICE: [9/11] espressif/iperf (0.1.3)
NOTICE: [10/11] espressif/iperf-cmd (0.1.3)
NOTICE: [11/11] idf (5.5.0)
```
The Wi-Fi Remote and ESP-Hosted components are automatically fetched during the configuration.
* Build
```sh
idf.py build
```
* Flash
```sh
idf.py -p <host_serial_port> flash
```
* Monitor
```sh
idf.py -p <host_serial_port> monitor
```
### Using ESP-Hosted with other hosts
As the other hosts may not have prior hardware communication bus set-up, the hardware connections and co-processor flashing with slave firmware need to be done explicitly. See the [ESP-Hosted Repository](https://github.com/espressif/esp-hosted-mcu/) for step-by-step instructions on setting up ESP-Hosted.

View File

@@ -7,6 +7,14 @@ dependencies:
version: "~0.1.8"
esp-qa/ping-cmd:
version: "~1.0.0"
espressif/esp_wifi_remote:
version: "~0.5.3"
rules:
- if: "target in [esp32p4, esp32h2]"
espressif/esp_hosted:
version: "~1"
rules:
- if: "target in [esp32p4, esp32h2]"
espressif/esp-extconn:
version: "~0.1.0"
rules:

View File

@@ -35,7 +35,7 @@ extern int wifi_cmd_get_rx_statistics(int argc, char **argv);
extern int wifi_cmd_clr_rx_statistics(int argc, char **argv);
#endif
#ifdef CONFIG_ESP_EXT_CONN_ENABLE
#if defined(CONFIG_ESP_EXT_CONN_ENABLE) && defined(CONFIG_ESP_HOST_WIFI_ENABLED)
#include "esp_extconn.h"
#endif
@@ -72,7 +72,7 @@ void iperf_hook_show_wifi_stats(iperf_traffic_type_t type, iperf_status_t status
void app_main(void)
{
#if CONFIG_ESP_EXT_CONN_ENABLE
#if defined(CONFIG_ESP_EXT_CONN_ENABLE) && defined(CONFIG_ESP_HOST_WIFI_ENABLED)
esp_extconn_config_t ext_config = ESP_EXTCONN_CONFIG_DEFAULT();
esp_extconn_init(&ext_config);
#endif

View File

@@ -0,0 +1,19 @@
#
# ESP32-P4 specific
#
CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16
CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64
CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=64
CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y
CONFIG_ESP_WIFI_TX_BA_WIN=32
CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y
CONFIG_ESP_WIFI_RX_BA_WIN=32
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=65534
CONFIG_LWIP_TCP_WND_DEFAULT=65534
CONFIG_LWIP_TCP_RECVMBOX_SIZE=64
CONFIG_LWIP_UDP_RECVMBOX_SIZE=64
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64
CONFIG_LWIP_TCP_SACK_OUT=y