Skip to content

Commit 2bec3bc

Browse files
feat(hosted_examples): Added ESP-Hosted to Wi-Fi examples
- add ESP32-P4 and ESP32-H2 as Supported Targets to following examples, using ESP-Hosted and Wi-Fi Remote as components: - iperf (H2) - getting_started/softAP - getting_started/station - scan - fast_scan - softap_sta - updated `.build-test-rules.yml` to enable pre-commit to accept ESP-P4 and ESP-H2 as Supported Targets - updated iperf sdkconfig.defaults for P4 to use parameters from wifi-remote
1 parent 92b8444 commit 2bec3bc

File tree

16 files changed

+180
-87
lines changed

16 files changed

+180
-87
lines changed

examples/wifi/.build-test-rules.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@
1616

1717
examples/wifi:
1818
<<: *wifi_depends_default
19+
enable:
20+
- if: IDF_TARGET == "esp32h2"
1921
disable:
20-
- if: SOC_WIFI_SUPPORTED != 1
22+
- if: (SOC_WIFI_SUPPORTED != 1) and (SOC_WIRELESS_HOST_SUPPORTED != 1)
23+
24+
examples/wifi/fast_scan:
25+
enable:
26+
- if: IDF_TARGET == "esp32h2"
27+
disable:
28+
- if: (SOC_WIFI_SUPPORTED != 1) and (SOC_WIRELESS_HOST_SUPPORTED != 1)
2129

2230
examples/wifi/ftm:
2331
<<: *wifi_depends_default
@@ -27,12 +35,16 @@ examples/wifi/ftm:
2735

2836
examples/wifi/getting_started:
2937
<<: *wifi_depends_default
38+
enable:
39+
- if: IDF_TARGET == "esp32h2"
3040
disable:
31-
- if: SOC_WIFI_SUPPORTED != 1
41+
- if: (SOC_WIFI_SUPPORTED != 1) and (SOC_WIRELESS_HOST_SUPPORTED != 1)
3242
depends_filepatterns:
3343
- examples/wifi/getting_started/**/*
3444

3545
examples/wifi/iperf:
46+
enable:
47+
- if: IDF_TARGET == "esp32h2"
3648
disable:
3749
- if: (SOC_WIFI_SUPPORTED != 1) and (SOC_WIRELESS_HOST_SUPPORTED != 1)
3850
- if: (IDF_TARGET == "esp32p4") and CONFIG_NAME in ["defaults", "99"]
@@ -70,6 +82,18 @@ examples/wifi/power_save:
7082
- wpa_supplicant
7183
- esp_driver_uart
7284

85+
examples/wifi/scan:
86+
enable:
87+
- if: IDF_TARGET == "esp32h2"
88+
disable:
89+
- if: (SOC_WIFI_SUPPORTED != 1) and (SOC_WIRELESS_HOST_SUPPORTED != 1)
90+
91+
examples/wifi/softap_sta:
92+
enable:
93+
- if: IDF_TARGET == "esp32h2"
94+
disable:
95+
- if: (SOC_WIFI_SUPPORTED != 1) and (SOC_WIRELESS_HOST_SUPPORTED != 1)
96+
7397
examples/wifi/wifi_aware:
7498
disable:
7599
- if: SOC_WIFI_NAN_SUPPORT != 1

examples/wifi/README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
2-
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
1+
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | ESP32-P4 | ESP32-H2 |
2+
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
33

44
# Wi-Fi Examples
55

66
This directory contains a range of examples ESP-IDF projects. These are intended to demonstrate the Wi-Fi functionality, and to provide code that you can copy and adapt into your own projects.
77

8+
ESP Chips with Wi-Fi can use the examples as is.
9+
10+
ESP Chips without Wi-Fi (e.g., ESP32-P4 and ESP32-H2) can work with a [**two-chip solution**](#wi-fi-examples-with-two-chip-solution) described below.
11+
812
# Example Layout
913

1014
The examples are grouped into sub-directories by category. Each category directory contains one or more example projects:
@@ -23,6 +27,60 @@ The examples are grouped into sub-directories by category. Each category directo
2327
* `wpa2_enterprise` shows how ESP connects to AP with WPA2 enterprise encryption.
2428
* `wps` contains a how to use the Wi-Fi Protected Setup protocol.
2529

30+
## Wi-Fi Examples with Two-Chip Solution
31+
32+
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.
33+
34+
The two chip solution needs:
35+
36+
- Communication bus like SDIO or SPI between the host and co-processor
37+
- Co-processor flashed with ESP-Hosted co-processor (slave) software
38+
- 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/). This is handled by `idf_component.yml`. See the `idf_component.yml` in [iperf](iperf/main/idf_component.yml) for an example.
39+
40+
The ESP32-P4-Function-EV-Board is used here as a demonstration on how to run a Wi-Fi example.
41+
42+
### Running a Wi-Fi example on the ESP32-P4-Function-EV-Board
43+
44+
On this board,
45+
46+
* The ESP32-P4 is connected with the on-board ESP32-C6 (co-processor) using SDIO communication bus. See this ESP-Hosted ESP32-P4 EV Board [documentation](https://github.com/espressif/esp-hosted-mcu/blob/main/docs/esp32_p4_function_ev_board.md) for more information.
47+
* The ESP32-C6 on the ESP32-P4 EV Board is pre-flashed with ESP-Hosted co-processor (slave) software.
48+
* Only the example code needs to be built & flashed on the Host using the steps below.
49+
50+
#### Host Flashing
51+
52+
* Set ESP32-P4 as the target
53+
54+
```sh
55+
idf.py set-target esp32p4
56+
```
57+
58+
* Run Configure
59+
60+
```sh
61+
idf.py menuconfig
62+
```
63+
64+
Set `Component config` -> `Wi-Fi Remote` -> `choose slave target` to `esp32c6`.
65+
66+
Do any other project configuration required for the example.
67+
68+
* Build and Flash
69+
70+
```sh
71+
idf.py -p <host serial port> flash monitor
72+
```
73+
74+
### Co-processor Flashing
75+
76+
**(Optional, but recommended)**
77+
78+
The ESP32-C6 on the ESP32-P4 EV Board is already pre-flashed with ESP-Hosted co-processor software. Host software on the ESP-Hosted component is backward compatible with this co-processor software. It is recommended to upgrade to the latest software via [simplified co-processor OTA](https://github.com/espressif/esp-hosted-mcu/blob/main/docs/esp32_p4_function_ev_board.md#51-ota-updates) or by [manual flashing with ESP-Prog](https://github.com/espressif/esp-hosted-mcu/blob/main/docs/esp32_p4_function_ev_board.md#52-using-esp-prog).
79+
80+
### Troubleshooting
81+
82+
For any technical queries on the two-chip solution, please open an [ESP-Hosted issue](https://github.com/espressif/esp-hosted-mcu/issues) on GitHub.
83+
2684
# More
2785

2886
See the [README.md](../README.md) file in the upper level [examples](../) directory for more information about examples.

examples/wifi/fast_scan/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 |
2-
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- |
1+
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | ESP32-P4 | ESP32-H2 |
2+
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- |
33

44
# Wi-Fi Fast Scan Example
55

@@ -92,6 +92,10 @@ I (2086) esp_netif_handlers: sta ip: 192.168.68.110, mask: 255.255.255.0, gw: 19
9292
9393
```
9494

95+
## Running the example on ESP Chips without Wi-Fi
96+
97+
This example can run on ESP Chips without Wi-Fi using ESP-Hosted. See the [Two-Chip Solution](../README.md#wi-fi-examples-with-two-chip-solution) section in the upper level `README.md` for information.
98+
9599
## Troubleshooting
96100

97101
For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.

examples/wifi/fast_scan/main/Kconfig.projbuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ menu "Example Configuration"
6767

6868
config EXAMPLE_FAST_SCAN_RSSI_5G_ADJUSTMENT
6969
int "fast scan rssi 5g adjustment"
70-
depends on EXAMPLE_FAST_SCAN_THRESHOLD && SOC_WIFI_SUPPORT_5G
70+
depends on EXAMPLE_FAST_SCAN_THRESHOLD && (SOC_WIFI_SUPPORT_5G || SLAVE_SOC_WIFI_SUPPORT_5G)
7171
range 0 128
7272
default 10
7373
help

examples/wifi/fast_scan/main/fast_scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#else
6262
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
6363
#endif
64-
#if CONFIG_SOC_WIFI_SUPPORT_5G
64+
#if CONFIG_SOC_WIFI_SUPPORT_5G || CONFIG_SLAVE_SOC_WIFI_SUPPORT_5G
6565
#define DEFAULT_RSSI_5G_ADJUSTMENT CONFIG_EXAMPLE_FAST_SCAN_RSSI_5G_ADJUSTMENT
6666
#else
6767
#define DEFAULT_RSSI_5G_ADJUSTMENT 0
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## IDF Component Manager Manifest File
2+
dependencies:
3+
espressif/esp_wifi_remote:
4+
version: ">=0.10,<2.0"
5+
rules:
6+
- if: "target in [esp32p4, esp32h2]"
7+
espressif/esp_hosted:
8+
version: "~2"
9+
rules:
10+
- if: "target in [esp32p4, esp32h2]"

examples/wifi/getting_started/softAP/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 |
2-
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- |
1+
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | ESP32-P4 | ESP32-H2 |
2+
| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- | -------- |
33

44
# Wi-Fi SoftAP Example
55

@@ -51,6 +51,10 @@ I (26467) wifi softAP: station:70:ef:00:43:96:67 join, AID=1
5151
I (27657) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2
5252
```
5353

54+
## Running the example on ESP Chips without Wi-Fi
55+
56+
This example can run on ESP Chips without Wi-Fi using ESP-Hosted. See the [Two-Chip Solution](../../README.md#wi-fi-examples-with-two-chip-solution) section in the upper level `README.md` for information.
57+
5458
## Troubleshooting
5559

5660
For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## IDF Component Manager Manifest File
2+
dependencies:
3+
espressif/esp_wifi_remote:
4+
version: ">=0.10,<2.0"
5+
rules:
6+
- if: "target in [esp32p4, esp32h2]"
7+
espressif/esp_hosted:
8+
version: "~2"
9+
rules:
10+
- if: "target in [esp32p4, esp32h2]"

examples/wifi/getting_started/station/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 |
2-
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- |
1+
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | ESP32-P4 | ESP32-H2 |
2+
| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- | -------- |
33

44
# Wi-Fi Station Example
55

@@ -116,6 +116,10 @@ I (10299) wifi station: connect to the AP fail
116116
I (10299) wifi station: Failed to connect to SSID:myssid, password:mypassword
117117
```
118118

119+
## Running the example on ESP Chips without Wi-Fi
120+
121+
This example can run on ESP Chips without Wi-Fi using ESP-Hosted. See the [Two-Chip Solution](../../README.md#wi-fi-examples-with-two-chip-solution) section in the upper level `README.md` for information.
122+
119123
## Troubleshooting
120124

121125
For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies:
2+
espressif/esp_wifi_remote:
3+
version: ">=0.10,<2.0"
4+
rules:
5+
- if: "target in [esp32p4, esp32h2]"
6+
espressif/esp_hosted:
7+
version: "~2"
8+
rules:
9+
- if: "target in [esp32p4, esp32h2]"

0 commit comments

Comments
 (0)