Skip to content

Commit 700e41f

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'feat/hosted_in_iperf' into 'master'
feat(hosted_in_iperf): Adds esp_hosted for P4 See merge request espressif/esp-idf!32459
2 parents d59f732 + ad9c563 commit 700e41f

File tree

4 files changed

+97
-4
lines changed

4 files changed

+97
-4
lines changed

examples/wifi/iperf/README.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ The iperf example doesn't support all features in standard iperf. It's compatibl
1010

1111
## Note about 80MHz flash frequency (ESP32)
1212
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.
13-
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
14-
frequency to 80MHz, please make sure R140~R145 are removed from ESP-WROVER-KIT or use ESP32 DevKitC.
13+
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
14+
frequency to 80MHz, please make sure R140\~R145 are removed from ESP-WROVER-KIT or use ESP32 DevKitC.
1515

1616
## Introduction
1717
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
7676
Steps to test station/soft-AP TCP/UDP RX/TX throughput are similar as test steps in station TCP TX.
7777

7878
See the README.md file in the upper level 'examples' directory for more information about examples.
79+
80+
## ESP Chips without Native Wi-Fi
81+
82+
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.
83+
84+
The two chip solution needs:
85+
86+
- Communication bus like SDIO or SPI between the host and co-processor
87+
- Co-processor flashed with ESP-Hosted co-processor (slave) software
88+
- 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/)
89+
90+
### Running iperf on the ESP32-P4-Function-EV-Board
91+
92+
On this board,
93+
94+
* 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.
95+
* The ESP32-C6 is pre-flashed with ESP-Hosted slave software.
96+
* 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)
97+
* Only the example code on the Host needs to be built & flashed using the steps below.
98+
99+
#### Host Flashing Steps
100+
101+
* Set the ESP32-P4 as the target
102+
103+
```sh
104+
idf.py set-target esp32p4
105+
```
106+
107+
You may see lines similar to this:
108+
109+
```
110+
NOTICE: Processing 11 dependencies:
111+
NOTICE: [1/11] cmd_system (*) (/home/esp/esp-idf/examples/system/console/advanced/components/cmd_system)
112+
NOTICE: [2/11] esp-qa/ping-cmd (1.0.0)
113+
NOTICE: [3/11] esp-qa/wifi-cmd (0.1.10)
114+
NOTICE: [4/11] espressif/eppp_link (0.2.0)
115+
NOTICE: [5/11] espressif/esp-extconn (0.1.0)
116+
NOTICE: [6/11] espressif/esp_hosted (1.1.1)
117+
NOTICE: [7/11] espressif/esp_serial_slave_link (1.1.0)
118+
NOTICE: [8/11] espressif/esp_wifi_remote (0.5.3)
119+
NOTICE: [9/11] espressif/iperf (0.1.3)
120+
NOTICE: [10/11] espressif/iperf-cmd (0.1.3)
121+
NOTICE: [11/11] idf (5.5.0)
122+
```
123+
124+
The Wi-Fi Remote and ESP-Hosted components are automatically fetched during the configuration.
125+
126+
* Build
127+
128+
```sh
129+
idf.py build
130+
```
131+
* Flash
132+
133+
```sh
134+
idf.py -p <host_serial_port> flash
135+
```
136+
* Monitor
137+
138+
```sh
139+
idf.py -p <host_serial_port> monitor
140+
```
141+
142+
### Using ESP-Hosted with other hosts
143+
144+
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.

examples/wifi/iperf/main/idf_component.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ dependencies:
77
version: "~0.1.8"
88
esp-qa/ping-cmd:
99
version: "~1.0.0"
10+
espressif/esp_wifi_remote:
11+
version: "~0.5.3"
12+
rules:
13+
- if: "target in [esp32p4, esp32h2]"
14+
espressif/esp_hosted:
15+
version: "~1"
16+
rules:
17+
- if: "target in [esp32p4, esp32h2]"
1018
espressif/esp-extconn:
1119
version: "~0.1.0"
1220
rules:

examples/wifi/iperf/main/iperf_example_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern int wifi_cmd_get_rx_statistics(int argc, char **argv);
3535
extern int wifi_cmd_clr_rx_statistics(int argc, char **argv);
3636
#endif
3737

38-
#ifdef CONFIG_ESP_EXT_CONN_ENABLE
38+
#if defined(CONFIG_ESP_EXT_CONN_ENABLE) && defined(CONFIG_ESP_HOST_WIFI_ENABLED)
3939
#include "esp_extconn.h"
4040
#endif
4141

@@ -72,7 +72,7 @@ void iperf_hook_show_wifi_stats(iperf_traffic_type_t type, iperf_status_t status
7272

7373
void app_main(void)
7474
{
75-
#if CONFIG_ESP_EXT_CONN_ENABLE
75+
#if defined(CONFIG_ESP_EXT_CONN_ENABLE) && defined(CONFIG_ESP_HOST_WIFI_ENABLED)
7676
esp_extconn_config_t ext_config = ESP_EXTCONN_CONFIG_DEFAULT();
7777
esp_extconn_init(&ext_config);
7878
#endif
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# ESP32-P4 specific
3+
#
4+
5+
CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16
6+
CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64
7+
CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=64
8+
CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y
9+
CONFIG_ESP_WIFI_TX_BA_WIN=32
10+
CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y
11+
CONFIG_ESP_WIFI_RX_BA_WIN=32
12+
13+
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=65534
14+
CONFIG_LWIP_TCP_WND_DEFAULT=65534
15+
CONFIG_LWIP_TCP_RECVMBOX_SIZE=64
16+
CONFIG_LWIP_UDP_RECVMBOX_SIZE=64
17+
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64
18+
19+
CONFIG_LWIP_TCP_SACK_OUT=y

0 commit comments

Comments
 (0)