ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Hello.
I'm new in ESP32 IDF and I'm using ESP IDF Stable v.3.2
I need to use ESP32 in Station + soft-AP (WIFI_MODE_APSTA) mode.
In examples, there are separate examples for Station and soft-AP.
Questions to Espressif Systems:
1. There is no working example - why?
2. Could you prepare one?
Where is an example?
I spend a lot of time to find some working examples for WIFI_MODE_APSTA mode, but not found any.
Do somebody know, where i can find working for IDF?
Regards,
Jack
I'm new in ESP32 IDF and I'm using ESP IDF Stable v.3.2
I need to use ESP32 in Station + soft-AP (WIFI_MODE_APSTA) mode.
In examples, there are separate examples for Station and soft-AP.
Questions to Espressif Systems:
1. There is no working example - why?
2. Could you prepare one?
Where is an example?
I spend a lot of time to find some working examples for WIFI_MODE_APSTA mode, but not found any.
Do somebody know, where i can find working for IDF?
Regards,
Jack
Re: ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Hi Jack,qwertxx wrote: ↑Sun May 19, 2019 9:33 amHello.
I'm new in ESP32 IDF and I'm using ESP IDF Stable v.3.2
I need to use ESP32 in Station + soft-AP (WIFI_MODE_APSTA) mode.
In examples, there are separate examples for Station and soft-AP.
Questions to Espressif Systems:
1. There is no working example - why?
2. Could you prepare one?
Where is an example?
I spend a lot of time to find some working examples for WIFI_MODE_APSTA mode, but not found any.
Do somebody know, where i can find working for IDF?
Regards,
Jack
We have already checked ESP32 IDF 3.2 and master branch with ESP32 IDF STA, AP and STA+AP mode examples and it is working fine.
Would you please check examples provided into ESP32 IDF into wifi examples?
Let me know if didn't find examples for that.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Hello, I am also looking for a working example of the APSTA mode (AP+STA example) and I cannot find the working example mentioned in the version 3.2 ESP IDF. I just downloaded version 3.2.2 and looked in the examples->wifi->getting_started folder and only "softAP" and "station" is included there. I do not see any example for using the ESP as an AP and station. Is it in another location?
thanks very much for your help.
thanks very much for your help.
Re: ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Hello,kjames wrote: ↑Mon Jul 01, 2019 3:48 pmHello, I am also looking for a working example of the APSTA mode (AP+STA example) and I cannot find the working example mentioned in the version 3.2 ESP IDF. I just downloaded version 3.2.2 and looked in the examples->wifi->getting_started folder and only "softAP" and "station" is included there. I do not see any example for using the ESP as an AP and station. Is it in another location?
thanks very much for your help.
It has been provided AP and STA mode example separately into IDF itself. So you can create AP+STA mode example using reference examoles provided for individual mode.
So, Would you please try from your end now? Let me know if any issue or didn't get much idea for that.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Hello, thank you for replying so quickly. In the original post, it looks like the problem is that they are not sure of how to configure Station+softAP mode using the available examples. I have seen several posts where there is a similar problem and I have tried unsuccessfully as well. If I have time, I will give it another try and let you know if I am successful. However, as the original poster mentioned, it would save a lot of time if there was an already working example of this common problem. thank you again.
Re: ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Yes. I agree on this like they should provide examples for AP+STA mode.kjames wrote: ↑Tue Jul 02, 2019 8:03 amHello, thank you for replying so quickly. In the original post, it looks like the problem is that they are not sure of how to configure Station+softAP mode using the available examples. I have seen several posts where there is a similar problem and I have tried unsuccessfully as well. If I have time, I will give it another try and let you know if I am successful. However, as the original poster mentioned, it would save a lot of time if there was an already working example of this common problem. thank you again.
Anyways please try from your end and let me know if you have any issue or finding some difficulties to do it.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Hello,
Let me give few more details regarding AP+STA mode which will be helpful to move further for that.
Above is already available into esp_wifi_types.h file
Sample Code to configure AP+STA Mode. Here you need to define MACRO for each AP and STA mode values as per your requirement.
Then call esp_wifi_start() once above configuration will be filled
Let me give few more details regarding AP+STA mode which will be helpful to move further for that.
Code: Select all
typedef union {
wifi_ap_config_t ap; /**< configuration of AP */
wifi_sta_config_t sta; /**< configuration of STA */
} wifi_config_t;
Sample Code to configure AP+STA Mode. Here you need to define MACRO for each AP and STA mode values as per your requirement.
Code: Select all
wifi_config_t ap_config;
wifi_config_t sta_config;
memset(&ap_config, 0, sizeof(wifi_config_t));
strncpy((char *)ap_config.ap.ssid,AP_SSID,AP_SSID_LEN);
strncpy((char *)ap_config.ap.password, AP_PASSWORD, AP_PASSWORD_LEN));
ap_config.ap.authmode = AP_AUTH_MOD;
ap_config.ap.ssid_len = 0;
ap_config.ap.max_connection = AP_MAX_CONN;
ap_config.ap.channel = AP_CHANNEL;
memset(&sta_config, 0, sizeof(wifi_config_t));
strncpy((char *)sta_config.sta.ssid, STA_SSID, STA_SSID_LEN);
strncpy((char *)sta_config.sta.password, STA_PASSWORD, STA_PASSWORD_LEN));
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &ap_config));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &sta_config));
Code: Select all
/**
* @brief Start WiFi according to current configuration
* If mode is WIFI_MODE_STA, it create station control block and start station
* If mode is WIFI_MODE_AP, it create soft-AP control block and start soft-AP
* If mode is WIFI_MODE_APSTA, it create soft-AP and station control block and start soft-AP and station
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_NO_MEM: out of memory
* - ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
* - ESP_FAIL: other WiFi internal errors
*/
esp_err_t esp_wifi_start(void);
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Thank you again for your help. I'm still having trouble with it as I am trying to combine parameters from the station_example and softAp_example into the event_handler and wifi_init() and leaving the main basically the same. I won't be able to get it working without spending substantial time on this to figure out where the station+AP are conflicting in getting the APSTA mode to work. If there is complete working example that includes all macro definitions, event handler details, wifi_init() and main - that would be great, otherwise I will have to try this some other time. - thank you
Re: ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Hello,kjames wrote: ↑Tue Jul 02, 2019 12:00 pmThank you again for your help. I'm still having trouble with it as I am trying to combine parameters from the station_example and softAp_example into the event_handler and wifi_init() and leaving the main basically the same. I won't be able to get it working without spending substantial time on this to figure out where the station+AP are conflicting in getting the APSTA mode to work. If there is complete working example that includes all macro definitions, event handler details, wifi_init() and main - that would be great, otherwise I will have to try this some other time. - thank you
I think above example is almost 90 % to fulfill your requirement. You just have to define MACRO for AP and STA configurations only.
We are also using same examples as per our requirement and it is working fine without any issue.
So, Please try from your side and let me know if still issue is there.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: ESP IDF: Station + soft-AP (WIFI_MODE_APSTA) There is no working example - why? Where is?
Many thanks again for helping. I am still having an issue here. The access point is starting but the ESP does not connect as a station to my Android (for example) as it normally would in station mode. So it is not functioning as an access point + station, just as an access point and for some reason the access point is starting as "ESP_188539", even though I have named it "Test_Transmitter" in the attached code. If you have time to take a look, perhaps I am missing something. I've attached the code here. If you have any suggestions at all, I will give it another try. thank you very much
Who is online
Users browsing this forum: No registered users and 220 guests