Setting wifi configuration

Ritesh
Posts: 1111
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Setting wifi configuration

Postby Ritesh » Fri Dec 28, 2018 6:34 pm

burkulesomesh43 wrote:
Wed Dec 26, 2018 7:41 am
hoainguyen265 wrote:
Tue Dec 25, 2018 7:11 am
I think it just like using wifi on mobile phone. When use want to connect to another wifi, you just disconnect and reconnect. And calling

Code: Select all

esp_wifi_start();  esp_wifi_stop()
is the same with disable and enable wifi on mobile phone and doing this periodically is not good.

So in my opinion, if you just want change wifi ssid, just disconnect, set up new wifi ssid and reconnect is good choice.
Heyy, it works without wifi_disconnect. just changed ssid and reconnect.
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.
Regards,
Ritesh Prajapati

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Setting wifi configuration

Postby burkulesomesh43 » Mon Dec 31, 2018 2:00 pm

hoainguyen265 wrote:
Wed Dec 26, 2018 8:37 am
Nice :D
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

Ritesh
Posts: 1111
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Setting wifi configuration

Postby Ritesh » Tue Jan 01, 2019 8:16 am

burkulesomesh43 wrote:
Mon Dec 31, 2018 2:00 pm
hoainguyen265 wrote:
Wed Dec 26, 2018 8:37 am
Nice :D
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
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.
Regards,
Ritesh Prajapati

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Setting wifi configuration

Postby burkulesomesh43 » Tue Jan 01, 2019 10:44 am

Ritesh wrote:
Tue Jan 01, 2019 8:16 am
burkulesomesh43 wrote:
Mon Dec 31, 2018 2:00 pm
hoainguyen265 wrote:
Wed Dec 26, 2018 8:37 am
Nice :D
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
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.
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;
}
--
Somesh Burkule

Ritesh
Posts: 1111
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Setting wifi configuration

Postby Ritesh » Sat Jan 05, 2019 5:20 pm

burkulesomesh43 wrote:
Tue Jan 01, 2019 10:44 am
Ritesh wrote:
Tue Jan 01, 2019 8:16 am
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:41936
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.
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;
}
Hi,

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

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Setting wifi configuration

Postby burkulesomesh43 » Sun Jan 06, 2019 4:13 am

Ritesh wrote:
Sat Jan 05, 2019 5:20 pm
burkulesomesh43 wrote:
Tue Jan 01, 2019 10:44 am
Ritesh wrote:
Tue Jan 01, 2019 8:16 am


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.
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;
}
Hi,

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.
Yes I am using STA mode only. that error is rare. it comes sometimes and esp32 is gets stucked and error comes infinitely.
Not getting what is the issue.
--
Somesh Burkule

Ritesh
Posts: 1111
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Setting wifi configuration

Postby Ritesh » Sun Jan 06, 2019 6:39 am

burkulesomesh43 wrote:
Sun Jan 06, 2019 4:13 am
Ritesh wrote:
Sat Jan 05, 2019 5:20 pm
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;
}
Hi,

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.
Yes I am using STA mode only. that error is rare. it comes sometimes and esp32 is gets stucked and error comes infinitely.
Not getting what is the issue.
Hi,

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

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Setting wifi configuration

Postby burkulesomesh43 » Tue Jun 11, 2019 10:45 am

Ritesh wrote:
Fri Dec 28, 2018 6:31 pm
ESP_igrr wrote:
Tue Dec 25, 2018 10:19 am
Since 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.
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.
the limit is 100000 write cycles.
--
Somesh Burkule

Ritesh
Posts: 1111
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Setting wifi configuration

Postby Ritesh » Tue Jun 11, 2019 10:58 am

burkulesomesh43 wrote:
Tue Jun 11, 2019 10:45 am
Ritesh wrote:
Fri Dec 28, 2018 6:31 pm
ESP_igrr wrote:
Tue Dec 25, 2018 10:19 am
Since 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.
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.
the limit is 100000 write cycles.
Thanks a lot.

I just want to know that your issue has been resolved or still open?
Regards,
Ritesh Prajapati

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Setting wifi configuration

Postby burkulesomesh43 » Tue Jun 11, 2019 11:01 am

Ritesh wrote:
Tue Jun 11, 2019 10:58 am
burkulesomesh43 wrote:
Tue Jun 11, 2019 10:45 am
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.
the limit is 100000 write cycles.
Thanks a lot.

I just want to know that your issue has been resolved or still open?
Resolved.
--
Somesh Burkule

Who is online

Users browsing this forum: AlexESP32 and 19 guests