ESP32 + Wifi.Mode + ESPNow

potros
Posts: 3
Joined: Sat Nov 14, 2020 9:58 am

ESP32 + Wifi.Mode + ESPNow

Postby potros » Thu Aug 25, 2022 4:12 pm

Hi!

The case im traying to "solve" is the following:

ESP32 as receiver
ESP8266 as sender

Issues comes from ESP32, which works mainly as STA, so initially it was configured as wifi.mode(WIFI_STA). Later I wanted to integrate ESPNOW into it.

First "strange" thing is, if the sender would be another ESP32, it works well if its defined as STA, but as the sender is an ESP8266, to get it working, it must be configured as WIFI_AP_STA. I didnt found any reason for that... I have read that it might be becasue wifi might enter into energy save stage, which might stop transmisión if its STA, but configuring it as AP, force the micro to be always listening. I have checked if WiFi.setSleep(WIFI_PS_NONE) helpt, but it doens't. Any explanation/solution to keep STA mode?

So ok, I asume (without an understanding) that it must be WIFI_AP_STA. Its not needed to configure or bring up the AP (with Wifi.softAP()) to have EspNow working properly, which is nice, becasue I dont want another AP really active. Unfortunately, in my project, I need to configure the AP at the beginning of the code to really accept client connections, and then shut it down (if certain conditions), which keeps the softAP already configured. I thought the softAP, will lose all configurations once I switch to wifi.mode(WIFI_STA) and the turn it on again with wifi.mode(WIFI_AP_STA), but it brings up the network, which I would like to avoid. As workaround I could hide the SSID, but this is not a solution in reality. I have tried with softAPdisconnect() and enableAP(), but no success. So, how can I reset the AP configuration completly, once it has been already configured?

Any help will be very apreciated.

Thanks in advance.
potros

Who is online

Users browsing this forum: No registered users and 61 guests