Wi-Fi

  • wifi
  • ESP-NOW
  • STA
  • AP
  • WAPI
  • SM2
  • SM4
  • UART0
  • EspRFTestTool
  • ESP32-P4
  • ESP32-C5
  • SoftAP
  • esp_hosted
  • packet allocation failed
  • IRAM
  • SSID
  • Emoji
  • UTF-8
  • esp_wifi_set_band_mode
  • WIFI_BAND_MODE_AUTO
  • WIFI_BAND_MODE_2G_ONLY
  • WIFI_BAND_MODE_5G_ONLY
  • rssi_5g_adjustment
  • RSSI
  • esp_wifi_sta_get_rssi
  • esp_wifi_scan_start
  • esp_wifi_scan_get_ap_records
  • management frames
  • insufficient memory
  • dual-band
  • scan

When ESP32-C5 works as a STA and connects to a dual-band single-SSID router, will it prefer 2.4 GHz or 5 GHz?

When the RSSI values of 5 GHz and 2.4 GHz are the same, the system prefers 5 GHz by default. If the RSSI values differ, the system applies the rssi_5g_adjustment parameter, in dBm, as compensation. The module will switch to 2.4 GHz only when the actual 5 GHz signal strength is lower than the 2.4 GHz signal strength minus the rssi_5g_adjustment value.

Therefore, in the common dual-band single-SSID case where the signal strengths are treated as the same, ESP32-C5 will prefer 5 GHz.

Does ESP32-S3 require Wi-Fi calibration during production?

No. Espressif Wi-Fi chips have an internal auto-calibration mechanism. Self-calibration is performed during software initialization, so no Wi-Fi calibration is required during manufacturing.

How should the authentication mode be configured when ESP32 connects to Wi-Fi? Is AUTH OPEN compatible with all modes?

When connecting to Wi-Fi, the authentication mode should match the mode actually used by the router.

If the module is configured with WIFI_AUTH_OPEN, it can usually interoperate with most router authentication modes. However, there is one exception: starting from ESP-IDF v5.0, if you need to connect to a WEP/WPA network, authmode must be explicitly set to WIFI_AUTH_WEP or WIFI_AUTH_WPA_PSK.

Can ESP-NOW coexist and work at the same time as Wi-Fi Station mode?

Yes. ESP-NOW can coexist with Wi-Fi Station mode.

The key requirement is that the ESP-NOW channel must match the channel of the connected AP. After the device connects to a router as a Station, the Wi-Fi channel is determined by the AP, so ESP-NOW communication must use the same channel.

What is the WAPI support scope on ESP32? Does it support SM2 or SM4?

ESP32 supports only WAPI-PSK authentication. It does not support WAPI-CERT.

For cryptographic algorithms, ESP32 supports SM4, but this support is used only internally by the Wi-Fi protocol stack for WAPI-PSK encryption. Applications cannot call this hardware capability directly through a separate API. ESP32 does not support SM2.

If a product requires WAPI-CERT or SM2, use an external security solution or implement the requirement on the AP side.

Why does Wi-Fi RF testing stop working after UART0 output is disabled on a module?

The EspRFTestTool host application used for module RF testing sends test commands to the chip and receives responses through UART0. When UART0 is disabled, the RF test firmware cannot receive commands from the host, and the host cannot receive the data returned by the chip.

Keep UART0 communication enabled during Wi-Fi RF testing so that EspRFTestTool can communicate with the RF test firmware correctly.

When Wi-Fi STA and AP modes are enabled together, why can a STA scan or connection attempt to a nonexistent AP temporarily stop the local AP?

ESP32 products use a single antenna. When STA and AP modes run concurrently, scanning channels or attempting to connect to a target AP occupies the antenna. The local AP cannot operate continuously during that interval, so it may become temporarily unavailable or its clients may disconnect briefly.

This behavior is caused by the single-antenna hardware limitation, and there is currently no software solution that can eliminate the impact completely. Account for AP availability during STA scans or reconnection attempts in the application workflow. For example, avoid unnecessary scans and allow clients to reconnect at the application level.

In an ESP32-P4 + ESP32-C5 Hosted solution, how can the limit of only 12 simultaneous STA connections to the SoftAP started by ESP32-P4 be resolved?

Symptoms:

With ESP-IDF v5.5.4, an ESP32-C5 running SoftAP on its own can accept 15 simultaneous STA connections. In an ESP32-P4 + ESP32-C5 Hosted solution, however, the SoftAP started by ESP32-P4 accepts only 12 simultaneous STA connections. After setting Component config > Wi-Fi Remote > Enable Wi-Fi Remote component > Wi-Fi configuration > Maximum espnow encrypt peers number to 2 on ESP32-P4, and Component config > Wi-Fi > Maximum espnow encrypt peers number to 2 on the ESP32-C5 slave, ESP32-C5 prints the following logs:

W (278329) wifi:packet allocation failed
W (278329) wifi:packet allocation failed
I (278331) wifi:removing station <4e:f1:0b:60:d4:7e> after unsuccessful auth/assoc, AID = 0
W (278334) wifi:rm mis
W (282409) wifi:packet allocation failed
W (282409) wifi:packet allocation failed
I (282410) wifi:removing station <4e:f1:0b:60:d4:7e> after unsuccessful auth/assoc, AID = 0
W (282414) wifi:rm mis

Cause:

The wifi:packet allocation failed messages indicate that dynamic allocation of management frames failed. Insufficient available memory prevents some STAs from completing authentication or association.

Solution:

Set the following configuration options to n to optimize memory usage:

CONFIG_FREERTOS_IN_IRAM=n

CONFIG_ESP_WIFI_IRAM_OPT=n
CONFIG_ESP_WIFI_EXTRA_IRAM_OPT=n
CONFIG_ESP_WIFI_RX_IRAM_OPT=n
CONFIG_ESP_WIFI_SLP_IRAM_OPT=n

CONFIG_PM_SLEEP_FUNC_IN_IRAM=n
CONFIG_PM_SLP_IRAM_OPT=n
CONFIG_ESP_TIMER_IN_IRAM=n

During Wi-Fi provisioning, can Espressif modules connect to an AP whose SSID contains special characters such as Emoji?

Both ESP32 and ESP8266 support UTF-8 encoding. Emoji are Unicode characters and are usually represented using UTF-8. When an ESP-IDF Wi-Fi API such as esp_wifi_set_config() sets an SSID, it essentially passes a byte array to the underlying layer. Therefore, a connection can be attempted if both ends use the same encoding and the total SSID length does not exceed 32 bytes.

Whether the connection succeeds also depends on whether the router or hotspot supports that SSID encoding and whether the AP and module use the same encoding.

Does ESP32-C5 support simultaneous operation on 2.4 GHz and 5 GHz Wi-Fi, and how is the operating band configured?

Cause:

ESP32-C5 currently does not support simultaneous operation on the 2.4 GHz and 5 GHz bands. It can operate on only one band at a time and uses time-division multiplexing between the two bands.

Solution:

Use esp_wifi_set_band_mode() to set the operating band:

  1. The default is WIFI_BAND_MODE_AUTO, which scans both 2.4 GHz and 5 GHz. If multiple hotspots share the same name, it connects to the hotspot with the best RSSI.
  2. With WIFI_BAND_MODE_2G_ONLY, it connects only to 2.4 GHz hotspots.
  3. With WIFI_BAND_MODE_5G_ONLY, it connects only to 5 GHz hotspots.
  4. For a dual-band hotspot using a single SSID, adjust the offset through rssi_5g_adjustment in wifi_scan_threshold_t to determine whether 2.4 GHz or 5 GHz is preferred.

Is there an API for directly obtaining the RSSI of a specified AP?

Cause:

There is currently no dedicated API for querying the RSSI of a specified AP.

Solution:

  1. To query the RSSI of the currently connected AP, call esp_wifi_sta_get_rssi(), which returns the RSSI of the current AP connection.
  2. To query the RSSI of other nearby APs, perform a Wi-Fi scan. Refer to the ESP-IDF scan example: first call esp_wifi_scan_start() to start scanning, then call esp_wifi_scan_get_ap_records() to obtain a list of wifi_ap_record_t results. Match a record using the target AP's SSID or BSSID, then read its RSSI field.