Skip to main content

Module wifi

Module wifi 

Source
Available on crate feature wifi only.
Expand description

§Wi-Fi (Station, Access Point and Station/AP-coexistence)

§Introduction

The Wi-Fi module provides support for configuring and monitoring the Wi-Fi networking functionality. This includes configuration for:

  • Station mode (aka STA mode or Wi-Fi client mode). ESP32-C5 connects to an access point.
  • AP mode (aka Soft-AP mode or Access Point mode). Stations connect to the ESP32-C5.
  • Station/AP-coexistence mode (ESP32-C5 is concurrently an access point and a station connected to another access point).
  • Various security modes for the above (WPA, WPA2, … Please note that WPA3 is currently not supported)
  • Scanning for access points (active & passive scanning).
  • Promiscuous mode for monitoring of IEEE802.11 Wi-Fi packets.

§Expected heap memory usage

These are numbers measured via esp-alloc’s “internal-heap-stats” feature.

You can easily reproduce these measurements with your own application by checking the max_usage.

Please note that for these measurements the default ControllerConfig values are used. Changing these (especially queue sizes) will change the results. Also the amount of used memory varies between different targets.

  • Station: 47 - 57k
  • Open Access Point: 53 - 63k

§Wi-Fi performance considerations

The default configuration is quite conservative to reduce power and memory consumption.

There are a number of settings which influence the general performance (at the cost of memory usage).

Optimal settings are chip and applications specific. You can get inspiration from the ESP-IDF examples

Please note that the configuration keys are usually named slightly different and not all configuration keys apply.

By default the power-saving mode is PowerSaveMode::None and ESP_PHY_CONFIG_PHY_ENABLE_USB is enabled by default.

In addition pay attention to these configuration keys:

  • ESP_RADIO_CONFIG_RX_QUEUE_SIZE
  • ESP_RADIO_CONFIG_TX_QUEUE_SIZE
  • ESP_RADIO_CONFIG_MAX_BURST_SIZE

Modules§

ap
Wi-Fi access point.
csicsi and unstable
Wi-Fi Channel State Information (CSI).
eventunstable
Wi-Fi Events
scan
Wi-Fi scanning.
sniffersniffer and unstable
Wi-Fi sniffer.
sta
Wi-Fi station.

Structs§

AccessPointStationConnectedInfo
Information about a station connected to the access point.
AccessPointStationDisconnectedInfo
Information about a station disconnected from the access point.
Bandwidths
Supported Wi-Fi protocols for each band.
ConnectedStationInfo
Information about a connected station.
ControllerConfig
Wi-Fi configuration.
CountryInfounstable
Country information.
DisconnectedStationInfo
Information about a disconnected station.
Interface
Wi-Fi interface.
Interfaces
Represents the Wi-Fi controller and its associated interfaces.
Protocols
Supported Wi-Fi protocols for each band.
RxControlInfounstable
The radio metadata header of the received packet, which is the common header at the beginning of all RX callback buffers in promiscuous mode.
Ssid
Information about a connected station.
WifiController
Wi-Fi controller.

Enums§

AccessPointStationEventInfo
Either the AccessPointStationConnectedInfo or AccessPointStationDisconnectedInfo.
AuthenticationMethod
Supported Wi-Fi authentication methods.
BandMode
Wi-Fi band mode.
Bandwidth
Wi-Fi bandwidth options.
Config
Configuration of Wi-Fi operation mode.
DisconnectReason
Reason for disconnection.
OperatingClassunstable
Wi-Fi operating class.
PowerSaveModeunstable
Power saving mode settings for the modem.
Protocol
Supported Wi-Fi protocols.
SecondaryChannel
Secondary Wi-Fi channels.
WifiError
Common errors.

Functions§

new
Create a Wi-Fi controller and it’s associated interfaces. The default initial configuration is [Config::Station(StationConfig::default())].