WIFI_MODE_APSTA interface support for AP (BGN) and STA (LR)?

User avatar
seraffimo
Posts: 6
Joined: Wed May 19, 2021 2:46 am

WIFI_MODE_APSTA interface support for AP (BGN) and STA (LR)?

Postby seraffimo » Tue Sep 07, 2021 3:40 pm

I would like to setup a network of ESP32S2's.

The design is:
a) master controller to serve as a WIFI AP (for connection to iphone) as well as WIFI STATION (for ESP_NOW traffic).
b) slave responders as WIFI STATIONS using ESP NOW and WIFI_PROTOCOL_LR.

I can get two ESP32S2's to communicate if both controller and responders are setup as:
esp_wifi_set_mode(WIFI_MODE_STA)
esp_wifi_set_protocol(ESP_IF_WIFI_STA, WIFI_PROTOCOL_LR)

However ... the following only partially works as it does not result in an access point being setup or available.

Controller setup:
esp_wifi_set_mode(WIFI_MODE_APSTA)
...
esp_wifi_set_protocol(ESP_IF_WIFI_AP, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N)
...
esp_wifi_set_protocol(ESP_IF_WIFI_STA, WIFI_PROTOCOL_LR)

Responder setup:
esp_wifi_set_mode(WIFI_MODE_STA)
esp_wifi_set_protocol(ESP_IF_WIFI_STA, WIFI_PROTOCOL_LR)

My specific question is, can you setup the two interfaces on the controller (one ESP32S2 or any other Espressif chip) when in mode WIFI_MODE_APSTA; one acting as a WIFI AP supporting BGN and one acting as a WIFI STA supporting just the WIFI_PROTOCOL_LR (for ESP-NOW)? My IDF is v4.2.

nopnop2002
Posts: 112
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: WIFI_MODE_APSTA interface support for AP (BGN) and STA (LR)?

Postby nopnop2002 » Sun Sep 19, 2021 7:01 am

You can set up two interfaces on one ESP32.

In this sample,
One acts as WIFI_STA and the other acts as ESPNOW.

https://github.com/nopnop2002/esp-idf-espnow-gateway

User avatar
seraffimo
Posts: 6
Joined: Wed May 19, 2021 2:46 am

Re: WIFI_MODE_APSTA interface support for AP (BGN) and STA (LR)?

Postby seraffimo » Sun Sep 19, 2021 4:15 pm

nopnop - thanks for pointing out your code. I am familiar with setting up the ESP32 with two interfaces (APSTA). In fact that is the exact setup I am looking to use.

The specific issue I am having is with the ESPNOW long range protocol. (WIFI_PROTOCOL_LR).

If on the ESP32S2 device that was initialized in mode WIFI_MODE_APSTA I ...

a) Configure the AP interface with wifi-protocols ( WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N) and
b) STA interface with (WIFI_PROTOCOL_LR)

... the wifi does not publish its SSID - and cannot be used as access point. And thus I cannot use the ESPNOW long range feature.

(If I setup the STA interface with protocols 11B,11G and or 11N the AP publishes its SSID.)

I am curious if I am doing something wrong or if this is an unsupported configuration.


User avatar
seraffimo
Posts: 6
Joined: Wed May 19, 2021 2:46 am

Re: WIFI_MODE_APSTA interface support for AP (BGN) and STA (LR)?

Postby seraffimo » Mon Sep 27, 2021 7:19 pm

The example code does not setup an access point with a long range ESPNOW client. So no, does not work.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: WIFI_MODE_APSTA interface support for AP (BGN) and STA (LR)?

Postby WiFive » Tue Sep 28, 2021 12:24 am

Seems like a bug but there is a new api esp_wifi_config_espnow_rate

user91829
Posts: 11
Joined: Thu Mar 03, 2022 11:20 am

Re: WIFI_MODE_APSTA interface support for AP (BGN) and STA (LR)?

Postby user91829 » Wed Mar 23, 2022 11:51 am

seraffimo wrote:
Mon Sep 27, 2021 7:19 pm
The example code does not setup an access point with a long range ESPNOW client. So no, does not work.
Did you figure it out? I am using IDF v4.4 and in the same situation.

iParcelBox
Posts: 31
Joined: Sun Oct 27, 2019 3:12 pm

Re: WIFI_MODE_APSTA interface support for AP (BGN) and STA (LR)?

Postby iParcelBox » Mon Nov 11, 2024 5:02 pm

I'm also trying to achieve exactly this using an ESP32S3 with IDF 5.3.1, but the same issue - as soon as I enable WIFI_PROTOCOL_11N on ESP_IF_WIFI_STA, ESP_IF_WIFI_AP is no longer visible to non-ESP devices.

Did anyone manage to get this working?

Who is online

Users browsing this forum: MicroController and 98 guests