From 3304a60e9ff7d27016ea4f56b1191395a17e249a Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Fri, 29 May 2026 08:50:14 +0200 Subject: [PATCH] feat(examples): Add ESP32-S31 support to network/sta2eth example --- examples/network/sta2eth/README.md | 10 +++++++--- examples/network/sta2eth/main/Kconfig.projbuild | 2 +- examples/network/sta2eth/main/hints.yml | 3 +++ examples/network/sta2eth/main/idf_component.yml | 5 +++-- 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 examples/network/sta2eth/main/hints.yml diff --git a/examples/network/sta2eth/README.md b/examples/network/sta2eth/README.md index 42871e79349..49a13d1749b 100644 --- a/examples/network/sta2eth/README.md +++ b/examples/network/sta2eth/README.md @@ -7,7 +7,7 @@ This example aims to demonstrate 1-1 bridge using WiFi station and one of these interfaces (so called *wired* in this example) - Ethernet (supported for all targets) -- USB acting as NCM device (supported for ESP32-S2 and ESP32-S3) +- USB acting as NCM device (supported for ESP32-S2, ESP32-S3 and ESP32-S31) It also allows for reconfiguring WiFi settings using a virtual network in the Ethernet. The reconfiguration mode is initialized if the WiFi settings are not available, connection fails or manually by long pressing the Boot button (GPIO0). It is possible to configure WiFi settings (SSID and password) in a browser on a hostname `"http://wifi.settings"` or using unified provisioning. @@ -22,7 +22,7 @@ This example also supports runtime configuration of WiFi settings by means of a ### Hardware Required -Any board with either Ethernet of USB-OTG supported. +Any WiFi enabled board with either Ethernet of USB-OTG supported. ### Configure the project @@ -30,7 +30,11 @@ Open the project configuration menu (`idf.py menuconfig`). In the `Example Configuration` menu choose the provisioning method: * `EXAMPLE_WIFI_CONFIGURATION_MANUAL` for manual configuration using a webpage -* `EXAMPLE_WIFI_CONFIGURATION_PROVISIONING` for standard provisioning over the virtual USB network +* `EXAMPLE_WIFI_CONFIGURATION_PROVISIONING` for standard provisioning over the virtual USB network + +In the `Example Configuration` menu choose your wired interface: +* `EXAMPLE_WIRED_INTERFACE_IS_ETHERNET` for ethernet - supported on all targets +* `EXAMPLE_WIRED_INTERFACE_IS_USB` for USB - supported only on targets with USB-OTG peripheral. For this configuration, you must also enable NCM in TinyUSB by setting `TINYUSB_NET_MODE_NCM` in menuconfig To provision the device using network provisioning tools (if `EXAMPLE_WIFI_CONFIGURATION_PROVISIONING` is selected) you can use idf provisioning utility with transport set to `softap`: ```bash diff --git a/examples/network/sta2eth/main/Kconfig.projbuild b/examples/network/sta2eth/main/Kconfig.projbuild index 6c58cc706cb..969d8fb98be 100644 --- a/examples/network/sta2eth/main/Kconfig.projbuild +++ b/examples/network/sta2eth/main/Kconfig.projbuild @@ -72,7 +72,7 @@ menu "Example Configuration" prompt "Ethernet" config EXAMPLE_WIRED_INTERFACE_IS_USB bool - depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + depends on SOC_USB_OTG_SUPPORTED prompt "USB NCM" endchoice diff --git a/examples/network/sta2eth/main/hints.yml b/examples/network/sta2eth/main/hints.yml new file mode 100644 index 00000000000..51867d15d76 --- /dev/null +++ b/examples/network/sta2eth/main/hints.yml @@ -0,0 +1,3 @@ +- + re: "error: implicit declaration of function 'tinyusb_net_init';" + hint: "NCM class must be enabled in TinyUSB configuration.\nIn idf.py menuconfig, go to (Top) > Component config > TinyUSB Stack > Network driver (ECM/NCM/RNDIS) > Network mode and select 'NCM'." diff --git a/examples/network/sta2eth/main/idf_component.yml b/examples/network/sta2eth/main/idf_component.yml index 91fe75244fb..173c5e5fc57 100644 --- a/examples/network/sta2eth/main/idf_component.yml +++ b/examples/network/sta2eth/main/idf_component.yml @@ -3,11 +3,12 @@ dependencies: espressif/esp_tinyusb: version: "^2.0.0" rules: - - if: "idf_version >=4.4" - - if: "target in [esp32s2, esp32s3]" + - if: "$CONFIG{EXAMPLE_WIRED_INTERFACE_IS_ETHERNET} == False" dns_server: path: ${IDF_PATH}/examples/protocols/http_server/captive_portal/components/dns_server espressif/ethernet_init: version: "^1.3.0" + rules: + - if: "$CONFIG{EXAMPLE_WIRED_INTERFACE_IS_ETHERNET} == True" espressif/network_provisioning: version: "^1.0.5"