RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

Missing Wi-Fi features for ESP32

Open SrivamsiMalladi opened this issue 1 year ago • 2 comments

Description

I am looking forward to using RIOT-OS with ESP32 for developing IoT applications for which I will need certain features like

  • Switching between Station mode and SoftAP mode during runtime,
  • Scanning available networks during runtime (like the esp_wifi_scan_start() from the ESP-IDF's Wi-Fi Driver)
  • Connecting to a specific Wi-Fi network during runtime i.e. specifying the SSID and password of the network to connect to during runtime

From my understanding of the RIOT-OS's WiFi Network Interface for ESP32, it is

  • only possible to specify the mode (Station or SoftAP) in the makefile before building the application
  • not possible to scan for available networks
  • only possible to specify the SSID and password of the network to connect to in the makefile or during the make command

Please let me know if these features are already available or if I am missing something related to these features.

Useful links

SrivamsiMalladi avatar Sep 08 '22 11:09 SrivamsiMalladi

From my understanding of the RIOT-OS's WiFi Network Interface for ESP32, it is

  • only possible to specify the mode (Station or SoftAP) in the makefile before building the application
  • not possible to scan for available networks
  • only possible to specify the SSID and password of the network to connect to in the makefile or during the make command

You are absolutely right, the WiFi interface is statically configured at compile time. There have been no plans to change this yet.

The reason for this is the design of how RIOT handles network devices. In RIOT, network devices are statically configured at compile time and enabled at system startup. For the protocol stack, the network device is then just available regardless of whether it is an Ethernet or WiFi interface. Thus, there was no need to change the WiFi interface mode or change WiFi parameters at runtime, or search for available WiFi networks.

The correct approach to implement such features would be

You are welcome to contribute your ideas or even better the code :smile:

gschorcht avatar Sep 12 '22 07:09 gschorcht

Hello @gschorcht. I would like to try implementing these features. I would like to start with adding support for changing the SSID and PASS in STA mode during runtime. So, if I understood correctly, I need to

Then to use the functionality I wanted, I need to set the SSID and PASS in the netdev (esp_wifi_netdev_t) using the netdev.set(), which is currently being initialized by the auto_init_esp_wifi() in the init.c. My question is, when I change the SSID and PASS using .set(), does the ESP32 automatically try to connect to this new Wi-Fi, or some reload()/reinit() kind of function must be called to reinitialize the Wi-Fi driver to consider the new Wi-Fi credentials?

( I have only used drivers/internal files directly till now. Never tried to mess around with the internal driver files. So. sorry if I am asking too many or silly questions.)

SrivamsiMalladi avatar Sep 21 '22 11:09 SrivamsiMalladi