2019-01-16 18:04:45 +01:00
/*
* Copyright (C) 2019 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
2019-12-16 01:47:44 +01:00
* @defgroup cpu_esp_common_esp_wifi ESP-WiFi netdev interface
* @ingroup cpu_esp_common
* @ingroup cpu_esp32
2019-01-16 18:04:45 +01:00
* @ingroup cpu_esp8266
2019-12-16 01:47:44 +01:00
* @brief Network device driver for the ESP SoC WiFi interface
2019-01-16 18:04:45 +01:00
*
* @author Gunar Schorcht <gunar@schorcht.net>
2020-03-22 15:47:00 +01:00
*/
2019-01-16 18:04:45 +01:00
2019-12-16 01:47:44 +01:00
This module realizes a `netdev` interface for the built-in WiFi interface of
2020-03-22 15:47:00 +01:00
ESP SoCs.
@note On the ESP32 this `netdev` driver supports both WPA2 Personal Mode and
WPA2 Enterprise Mode. On ESP8266, only WPA2 Personal mode is currently
supported.
### WPA2 Personal Mode
To use the WiFi `netdev` driver in WPA2 Personal Mode with a
preshared key (PSK), module `esp_wifi` has to be enabled.
```
USEMODULE += esp_wifi
```
2019-01-16 18:04:45 +01:00
Furthermore, the following configuration parameters have to be defined:
2020-03-22 15:47:00 +01:00
<center>
Parameter | Default | Description
:------------------|:--------------------------|:------------
2023-02-17 15:18:48 +01:00
WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars).
2020-03-22 15:47:00 +01:00
ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
</center>
2019-01-16 18:04:45 +01:00
These configuration parameter definitions, as well as enabling the `esp_wifi`
module, can be done either in the makefile of the project or at make command
2020-03-22 15:47:00 +01:00
line, for example:
2019-01-16 18:04:45 +01:00
```
USEMODULE=esp_wifi \
2023-02-17 15:18:48 +01:00
CFLAGS='-DWIFI_SSID=\"MySSID\" -DWIFI_PASS=\"MyPassphrase\"' \
2019-01-16 18:04:45 +01:00
make -C examples/gnrc_networking BOARD=...
```
2020-03-22 15:47:00 +01:00
@note
- Module `esp_wifi` is not enabled automatically when module
`netdev_default` is used.
2023-02-17 15:18:48 +01:00
- Leave 'WIFI_PASS' undefined to connect to an open WiFi access point.
2020-03-22 15:47:00 +01:00
- The Wifi network interface (module `esp_wifi`) and the
ESP-NOW network interface (module `esp_now`)
can be used simultaneously, for example, to realize a border router for
a mesh network which uses ESP-NOW.
### WPA2 Enterprise Mode
To use the WiFi `netdev` driver in WPA2 Enterprise Mode with IEEE 802.1X/EAP
authentication, module `esp_wifi_enterprise` has to be enabled.
```
USEMODULE += esp_wifi_enterprise
```
It supports the following EAP authentication methods:
- PEAPv0
- PEAPv1
- TTLS
As inner (phase 2) EAP authentication method, only MSCHAPv2 is supported.
To use module `esp_wifi_enterprise` with these authentication methods, the
following configuration parameters have to be defined:
<center>
Parameter | Default | Description
:------------------|:----------|:------------
2023-02-17 16:08:51 +01:00
WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
WIFI_EAP_ID | none | Optional anonymous identity used in phase 1 (outer) EAP authentication. If it is not defined, the user name defined for phase 2 (inner) EAP authentication is used as idendity in phase 1.
WIFI_EAP_USER | none | User name used in phase 2 (inner) EAP authentication.
WIFI_EAP_PASS | none | Password used in phase 2 (inner) EAP authentication.
2020-03-22 15:47:00 +01:00
ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
</center>
These configuration parameter definitions, as well as enabling the `esp_wifi`
module, can be done either in the makefile of the project or at make command
line, for example:
```
USEMODULE=esp_wifi_enterprise \
2023-02-17 16:08:51 +01:00
CFLAGS='-DWIFI_SSID=\"MySSID\" -DWIFI_EAP_ID=\"anonymous\" -DWIFI_EAP_USER=\"MyUserName\" -DWIFI_EAP_PASS=\"MyPassphrase\"' \
2020-03-22 15:47:00 +01:00
make -C examples/gnrc_networking BOARD=...
```
@note
- Since there is no possibility to add the CA certificate to the RIOT image,
the verification of the AP certificate is not yet supported.
- Module `esp_wifi_enterprise` is not enabled automatically when module
`netdev_default` is used.
- The Wifi network interface (module `esp_wifi_enterprise`) and the
2019-12-16 01:47:44 +01:00
ESP-NOW network interface (module `esp_now`)
2019-01-16 18:04:45 +01:00
can be used simultaneously, for example, to realize a border router for
a mesh network which uses ESP-NOW.
2020-03-24 05:57:46 +01:00
In this case the ESP-NOW interface must use the same channel as the AP of the
infrastructure WiFi network. All ESP-NOW nodes must therefore be compiled with
the channel of the AP asvalue for the parameter 'ESP_NOW_CHANNEL'.
2019-01-16 18:04:45 +01:00
*/