/esp-idf-wifi-apsta

Example to WIFI_MODE_APSTA with esp-idf

Primary LanguageCMIT LicenseMIT

esp-idf-wifi-apsta

Example to WIFI_MODE_APSTA with esp-idf.

esp-idf contains examples in station mode (WIFI_MODE_STA) and softap mode (WIFI_MODE_AP), but there are no examples in apsta mode (WIFI_MODE_APSTA).

I referred here.

The ESP32/ESP32S3/ESP32C2/ESP32C3 chip has the following four MAC addresses:

  • MAC for WiFi STA mode
  • MAC for WiFi AP mode
  • MAC for Bluetooth Classic
  • MAC for Ethernet

The ESP32-S2 chip has the following three MAC addresses:

  • MAC for WiFi STA mode
  • MAC for WiFi AP mode
  • MAC for Ethernet

Since there are separate STA mode MACs and AP mode MACs, APSTA mode works as both AP and STATION.

Software requirements

ESP-IDF V4.4/V5.0.
ESP-IDF V5 is required when using ESP32-C2.

Installation

git clone https://github.com/nopnop2002/esp-idf-wifi-apsta
cd esp-idf-wifi-apsta
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3}
idf.py menuconfig
idf.py flash monitor
  • WIFI_CONNECT
    Select the Wifi connection method from the following:
    Connect to Wifi using AP mode.
    Connect to Wifi using STA mode.
    Connect to Wifi using APSTA mode.
  • AP_WIFI_SSID
    WiFi SSID of AP mode
  • AP_WIFI_PASSWORD
    WiFi Password of AP mode
  • AP_WIFI_CHANNEL
    WiFi Channel of AP mode
  • AP_MAX_STA_CONN
    Max number of the STA connects to AP
  • STA_WIFI_SSID
    WiFi SSID of STA mode
  • STA_WIFI_PASSWORD
    WiFi Password of STA mode
  • STA_CONNECT_TIMEOUT
    Connect timeout of STA mode

config-main

AP Mode

config-ap

STA Mode

config-sta

APSTA Mode

config-apsta