Yeah. Exactly, We are also doing same thing like changing WiFi configurations and reconnecting WiFi whenever want to switch router or hot-spot as per our requirements.burkulesomesh43 wrote: ↑Wed Dec 26, 2018 7:41 amHeyy, it works without wifi_disconnect. just changed ssid and reconnect.hoainguyen265 wrote: ↑Tue Dec 25, 2018 7:11 amI think it just like using wifi on mobile phone. When use want to connect to another wifi, you just disconnect and reconnect. And callingis the same with disable and enable wifi on mobile phone and doing this periodically is not good.Code: Select all
esp_wifi_start(); esp_wifi_stop()
So in my opinion, if you just want change wifi ssid, just disconnect, set up new wifi ssid and reconnect is good choice.
Setting wifi configuration
Re: Setting wifi configuration
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 132
- Joined: Tue Aug 14, 2018 6:21 am
- Location: India
Re: Setting wifi configuration
Heyy,
I am getting this error by changing configuration.
183188) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183188) wifi: alloc eb len=76 type=2 fail, heap:41928
W (1183198) wifi: m f probe req l=0
E (1183318) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183318) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183318) wifi: m f probe req l=0
E (1183438) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183438) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183438) wifi: m f probe req l=0
E (1183568) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183568) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183568) wifi: m f probe req l=0
E (1183688) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183688) wifi: alloc eb len=76 type=2 fail, heap:41936
--
Somesh Burkule
Somesh Burkule
Re: Setting wifi configuration
As per error logs it seems like memory is going to be leaked at low level of WiFi Stack. Would you please share code like what you have did? so that it will be helpful to give support for that.burkulesomesh43 wrote: ↑Mon Dec 31, 2018 2:00 pmHeyy,
I am getting this error by changing configuration.
183188) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183188) wifi: alloc eb len=76 type=2 fail, heap:41928
W (1183198) wifi: m f probe req l=0
E (1183318) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183318) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183318) wifi: m f probe req l=0
E (1183438) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183438) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183438) wifi: m f probe req l=0
E (1183568) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183568) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183568) wifi: m f probe req l=0
E (1183688) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183688) wifi: alloc eb len=76 type=2 fail, heap:41936
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 132
- Joined: Tue Aug 14, 2018 6:21 am
- Location: India
Re: Setting wifi configuration
I am switching into two networks in handler like this->>Ritesh wrote: ↑Tue Jan 01, 2019 8:16 amAs per error logs it seems like memory is going to be leaked at low level of WiFi Stack. Would you please share code like what you have did? so that it will be helpful to give support for that.burkulesomesh43 wrote: ↑Mon Dec 31, 2018 2:00 pmHeyy,
I am getting this error by changing configuration.
183188) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183188) wifi: alloc eb len=76 type=2 fail, heap:41928
W (1183198) wifi: m f probe req l=0
E (1183318) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183318) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183318) wifi: m f probe req l=0
E (1183438) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183438) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183438) wifi: m f probe req l=0
E (1183568) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183568) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183568) wifi: m f probe req l=0
E (1183688) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183688) wifi: alloc eb len=76 type=2 fail, heap:41936
Code: Select all
static esp_err_t event_handler(void *ctx, system_event_t *event)
{
switch(event->event_id) {
case SYSTEM_EVENT_STA_START:
ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_START");
esp_wifi_connect();
break;
case SYSTEM_EVENT_STA_CONNECTED:
ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_CONNECTED");
tryToConnect=0;
break;
case SYSTEM_EVENT_STA_GOT_IP:
ESP_LOGI("WIFI TEST ","SYSTEM_EVENT_STA_GOT_IP");
wifi_con_flag=1;
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
break;
case SYSTEM_EVENT_STA_DISCONNECTED:
ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_DISCONNECTED");
wifi_con_flag=0;
esp_wifi_disconnect();
ESP_LOGI("WIFI TEST ","tryToConnect: %d",tryToConnect);
//connect to set configuration
if(tryToConnect < 10){
ESP_LOGI("WIFI TEST ","set configuration");
memset(&wifi_config, 0, sizeof(wifi_config));
strcpy((char *)wifi_config.sta.ssid, "somesh");
strcpy((char *)wifi_config.sta.password,"123456" );
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
}else if(tryToConnect > 10 && tryToConnect < 15){
ESP_LOGI("WIFI TEST ","default configuration");
memset(&wifi_config, 0, sizeof(wifi_config));
strcpy((char *)wifi_config.sta.ssid, "default");
strcpy((char *)wifi_config.sta.password,"123456" );
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
}
esp_wifi_connect();
tryToConnect++;
if(tryToConnect == 15)tryToConnect=0;
xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
break;
default:
break;
}
return ESP_OK;
}
--
Somesh Burkule
Somesh Burkule
Re: Setting wifi configuration
Hi,burkulesomesh43 wrote: ↑Tue Jan 01, 2019 10:44 amI am switching into two networks in handler like this->>Ritesh wrote: ↑Tue Jan 01, 2019 8:16 amAs per error logs it seems like memory is going to be leaked at low level of WiFi Stack. Would you please share code like what you have did? so that it will be helpful to give support for that.burkulesomesh43 wrote: ↑Mon Dec 31, 2018 2:00 pm
Heyy,
I am getting this error by changing configuration.
183188) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183188) wifi: alloc eb len=76 type=2 fail, heap:41928
W (1183198) wifi: m f probe req l=0
E (1183318) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183318) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183318) wifi: m f probe req l=0
E (1183438) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183438) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183438) wifi: m f probe req l=0
E (1183568) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183568) wifi: alloc eb len=76 type=2 fail, heap:41936
W (1183568) wifi: m f probe req l=0
E (1183688) wifi: esf_buf: t=2 l=76 max:32, alloc:32 no eb
W (1183688) wifi: alloc eb len=76 type=2 fail, heap:41936Code: Select all
static esp_err_t event_handler(void *ctx, system_event_t *event) { switch(event->event_id) { case SYSTEM_EVENT_STA_START: ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_START"); esp_wifi_connect(); break; case SYSTEM_EVENT_STA_CONNECTED: ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_CONNECTED"); tryToConnect=0; break; case SYSTEM_EVENT_STA_GOT_IP: ESP_LOGI("WIFI TEST ","SYSTEM_EVENT_STA_GOT_IP"); wifi_con_flag=1; xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); break; case SYSTEM_EVENT_STA_DISCONNECTED: ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_DISCONNECTED"); wifi_con_flag=0; esp_wifi_disconnect(); ESP_LOGI("WIFI TEST ","tryToConnect: %d",tryToConnect); //connect to set configuration if(tryToConnect < 10){ ESP_LOGI("WIFI TEST ","set configuration"); memset(&wifi_config, 0, sizeof(wifi_config)); strcpy((char *)wifi_config.sta.ssid, "somesh"); strcpy((char *)wifi_config.sta.password,"123456" ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); }else if(tryToConnect > 10 && tryToConnect < 15){ ESP_LOGI("WIFI TEST ","default configuration"); memset(&wifi_config, 0, sizeof(wifi_config)); strcpy((char *)wifi_config.sta.ssid, "default"); strcpy((char *)wifi_config.sta.password,"123456" ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); } esp_wifi_connect(); tryToConnect++; if(tryToConnect == 15)tryToConnect=0; xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); break; default: break; } return ESP_OK; }
Are you getting issue on individual connection test like AP mode or STA mode? Because as per code there is no any issue into switching mechanism.
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 132
- Joined: Tue Aug 14, 2018 6:21 am
- Location: India
Re: Setting wifi configuration
Yes I am using STA mode only. that error is rare. it comes sometimes and esp32 is gets stucked and error comes infinitely.Ritesh wrote: ↑Sat Jan 05, 2019 5:20 pmHi,burkulesomesh43 wrote: ↑Tue Jan 01, 2019 10:44 amI am switching into two networks in handler like this->>Code: Select all
static esp_err_t event_handler(void *ctx, system_event_t *event) { switch(event->event_id) { case SYSTEM_EVENT_STA_START: ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_START"); esp_wifi_connect(); break; case SYSTEM_EVENT_STA_CONNECTED: ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_CONNECTED"); tryToConnect=0; break; case SYSTEM_EVENT_STA_GOT_IP: ESP_LOGI("WIFI TEST ","SYSTEM_EVENT_STA_GOT_IP"); wifi_con_flag=1; xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); break; case SYSTEM_EVENT_STA_DISCONNECTED: ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_DISCONNECTED"); wifi_con_flag=0; esp_wifi_disconnect(); ESP_LOGI("WIFI TEST ","tryToConnect: %d",tryToConnect); //connect to set configuration if(tryToConnect < 10){ ESP_LOGI("WIFI TEST ","set configuration"); memset(&wifi_config, 0, sizeof(wifi_config)); strcpy((char *)wifi_config.sta.ssid, "somesh"); strcpy((char *)wifi_config.sta.password,"123456" ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); }else if(tryToConnect > 10 && tryToConnect < 15){ ESP_LOGI("WIFI TEST ","default configuration"); memset(&wifi_config, 0, sizeof(wifi_config)); strcpy((char *)wifi_config.sta.ssid, "default"); strcpy((char *)wifi_config.sta.password,"123456" ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); } esp_wifi_connect(); tryToConnect++; if(tryToConnect == 15)tryToConnect=0; xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); break; default: break; } return ESP_OK; }
Are you getting issue on individual connection test like AP mode or STA mode? Because as per code there is no any issue into switching mechanism.
Not getting what is the issue.
--
Somesh Burkule
Somesh Burkule
Re: Setting wifi configuration
Hi,burkulesomesh43 wrote: ↑Sun Jan 06, 2019 4:13 amYes I am using STA mode only. that error is rare. it comes sometimes and esp32 is gets stucked and error comes infinitely.Ritesh wrote: ↑Sat Jan 05, 2019 5:20 pmHi,burkulesomesh43 wrote: ↑Tue Jan 01, 2019 10:44 am
I am switching into two networks in handler like this->>Code: Select all
static esp_err_t event_handler(void *ctx, system_event_t *event) { switch(event->event_id) { case SYSTEM_EVENT_STA_START: ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_START"); esp_wifi_connect(); break; case SYSTEM_EVENT_STA_CONNECTED: ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_CONNECTED"); tryToConnect=0; break; case SYSTEM_EVENT_STA_GOT_IP: ESP_LOGI("WIFI TEST ","SYSTEM_EVENT_STA_GOT_IP"); wifi_con_flag=1; xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); break; case SYSTEM_EVENT_STA_DISCONNECTED: ESP_LOGI("WIFI TEST","SYSTEM_EVENT_STA_DISCONNECTED"); wifi_con_flag=0; esp_wifi_disconnect(); ESP_LOGI("WIFI TEST ","tryToConnect: %d",tryToConnect); //connect to set configuration if(tryToConnect < 10){ ESP_LOGI("WIFI TEST ","set configuration"); memset(&wifi_config, 0, sizeof(wifi_config)); strcpy((char *)wifi_config.sta.ssid, "somesh"); strcpy((char *)wifi_config.sta.password,"123456" ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); }else if(tryToConnect > 10 && tryToConnect < 15){ ESP_LOGI("WIFI TEST ","default configuration"); memset(&wifi_config, 0, sizeof(wifi_config)); strcpy((char *)wifi_config.sta.ssid, "default"); strcpy((char *)wifi_config.sta.password,"123456" ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); } esp_wifi_connect(); tryToConnect++; if(tryToConnect == 15)tryToConnect=0; xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); break; default: break; } return ESP_OK; }
Are you getting issue on individual connection test like AP mode or STA mode? Because as per code there is no any issue into switching mechanism.
Not getting what is the issue.
As per error log it indicates that memory is going to be leaked at low level into wifi stack level. So, would you please try to deinit and again init wifi while switching from STA mode to AP mode?
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 132
- Joined: Tue Aug 14, 2018 6:21 am
- Location: India
Re: Setting wifi configuration
the limit is 100000 write cycles.Ritesh wrote: ↑Fri Dec 28, 2018 6:31 pmHi,ESP_igrr wrote: ↑Tue Dec 25, 2018 10:19 amSince by default Wi-Fi configuration is stored into flash, you may want to call esp_wifi_set_storage function with WIFI_STORAGE_RAM argument. In this case configuration will not be saved in flash, and flash lifetime will not be affected.
We are storing WiFi configurations into flash memory as per our requirements. So, what will be the lifetime of flash operation for single device? Because we are also in same phase like many times WiFi configurations will be changed as per our project requirements.
--
Somesh Burkule
Somesh Burkule
Re: Setting wifi configuration
Thanks a lot.burkulesomesh43 wrote: ↑Tue Jun 11, 2019 10:45 amthe limit is 100000 write cycles.Ritesh wrote: ↑Fri Dec 28, 2018 6:31 pmHi,ESP_igrr wrote: ↑Tue Dec 25, 2018 10:19 amSince by default Wi-Fi configuration is stored into flash, you may want to call esp_wifi_set_storage function with WIFI_STORAGE_RAM argument. In this case configuration will not be saved in flash, and flash lifetime will not be affected.
We are storing WiFi configurations into flash memory as per our requirements. So, what will be the lifetime of flash operation for single device? Because we are also in same phase like many times WiFi configurations will be changed as per our project requirements.
I just want to know that your issue has been resolved or still open?
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 132
- Joined: Tue Aug 14, 2018 6:21 am
- Location: India
Re: Setting wifi configuration
Resolved.Ritesh wrote: ↑Tue Jun 11, 2019 10:58 amThanks a lot.burkulesomesh43 wrote: ↑Tue Jun 11, 2019 10:45 amthe limit is 100000 write cycles.Ritesh wrote: ↑Fri Dec 28, 2018 6:31 pm
Hi,
We are storing WiFi configurations into flash memory as per our requirements. So, what will be the lifetime of flash operation for single device? Because we are also in same phase like many times WiFi configurations will be changed as per our project requirements.
I just want to know that your issue has been resolved or still open?
--
Somesh Burkule
Somesh Burkule
Who is online
Users browsing this forum: No registered users and 435 guests