Page 1 of 1

ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Wed May 23, 2018 5:40 am
by david@mandy
Hi,
I am using ESP32 with ESP-IDF v3.0 (stable version). My device has to send and receive messages over Azure IOT server.
But after some few data transactions for about 30 to 40 minutes, my device is getting disconnected from the router and retrying for connection.
But the re-connection is not happening. Only after restarting the module it will connect to the router again and the problem repeats. I am getting the following error.

I (2525809) wifi: bcn_timout,ap_probe_send_start
I (2528309) wifi: ap_probe_send over, resett wifi status to disassoc
I (2528309) wifi: state: run -> init (1)
I (2528309) wifi: pm stop, total sleep time: 0/-1797020403
I (2528309) wifi: n:9 0, o:9 0, ap:255 255, sta:9 0, prof:1

This is something that is disturbing the flow of my application and need to be fixed.

Thanks and regards.

Re: ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Thu May 24, 2018 6:42 am
by ESP_Alvin
Hi, david@mandy

Would you please help provide logs for this?

Thanks.

Re: ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Thu May 24, 2018 6:44 am
by sumesh
Dear Admins,

we are also facing the same issue, please do let me know if you have any findings

Re: ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Thu May 24, 2018 6:47 am
by flyric123
Hi,

We are having the same issue. Something to add here is: when the wifi disconnects, we can not start BLE either.

Is this a known issue? Any fix or work around?

Thanks,
Ric

Re: ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Thu May 24, 2018 8:05 am
by ESP_Alvin
Hi, Sumesh, and flyric123

Would your provide any logs for the issues you found? That would help a lot.

Thanks.

Re: ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Thu May 24, 2018 12:12 pm
by david@mandy
ESP_Alvin wrote:Hi, david@mandy

Would you please help provide logs for this?

Thanks.
Hi ESP_Alvin,
Thank you for your reply.
ESP32 is giving this error repeatedly. After giving this error, the module is trying to reconnect with the router, but it fails every time.
Below is the log. Here, we have disabled the LOG other than "wifi"..

"2018-05-21 21:00:29",CONNECT OK
"2018-05-21 21:00:29",192.168.43.87
"2018-05-21 21:00:30",SEND OK
"2018-05-21 21:00:31",SEND OK
"2018-05-21 21:00:31",I (586170) wifi: pm start, type:0

"2018-05-21 21:00:32",SEND OK
"2018-05-21 21:00:34",SEND OK
"2018-05-21 21:00:36",SEND OK
"2018-05-21 21:00:48",I (602910) wifi: bcn_timout,ap_probe_send_start
"2018-05-21 21:00:51",I (605410) wifi: ap_probe_send over, resett wifi status to disassoc
"2018-05-21 21:00:51",I (605410) wifi: state: run -> init (1)
"2018-05-21 21:00:51",I (605410) wifi: pm stop, total sleep time: 0/19242893

"2018-05-21 21:00:51",I (605410) wifi: n:7 0, o:7 0, ap:255 255, sta:7 0, prof:1
"2018-05-21 21:00:51",WIFI DISCONNECTED
"2018-05-21 21:00:53",WIFI DISCONNECTED
"2018-05-21 21:00:55",WIFI DISCONNECTED
"2018-05-21 21:00:58",WIFI DISCONNECTED
"2018-05-21 21:01:00",WIFI DISCONNECTED
"2018-05-21 21:01:03",WIFI DISCONNECTED
"2018-05-21 21:01:05",WIFI DISCONNECTED
"2018-05-21 21:01:05",OK
"2018-05-21 21:01:05",OK
"2018-05-21 21:01:05",OK
"2018-05-21 21:01:06",OK
"2018-05-21 21:01:06",DEFAULTS
"2018-05-21 21:01:06",Connecting to
"2018-05-21 21:01:06",My_ssid
"2018-05-21 21:01:06",FAIL TO CONNECT

"2018-05-21 21:01:06",OK
"2018-05-21 21:01:06",OK
"2018-05-21 21:01:06",OK
"2018-05-21 21:01:07",OK
"2018-05-21 21:01:07",DEFAULTS
"2018-05-21 21:01:07",Connecting to
"2018-05-21 21:01:07",My_ssid
"2018-05-21 21:01:07",FAIL TO CONNECT

"2018-05-21 21:01:07",OK
"2018-05-21 21:01:07",OK
"2018-05-21 21:01:07",OK
"2018-05-21 21:01:08",WIFI DISCONNECTED
"2018-05-21 21:01:08",OK
"2018-05-21 21:01:08",DEFAULTS
"2018-05-21 21:01:08",Connecting to
"2018-05-21 21:01:08",My_ssid
"2018-05-21 21:01:08",FAIL TO CONNECT

"2018-05-21 21:01:08",OK
"2018-05-21 21:01:08",OK
"2018-05-21 21:01:08",OK
"2018-05-21 21:01:09",OK
"2018-05-21 21:01:09",DEFAULTS
"2018-05-21 21:01:09",Connecting to
"2018-05-21 21:01:09",My_ssid
"2018-05-21 21:01:09",FAIL TO CONNECT

"2018-05-21 21:01:09",OK
"2018-05-21 21:01:09",OK
"2018-05-21 21:01:09",OK
"2018-05-21 21:01:10",OK
"2018-05-21 21:01:10",DEFAULTS
"2018-05-21 21:01:10",Connecting to
"2018-05-21 21:01:10",My_ssid
"2018-05-21 21:01:10",FAIL TO CONNECT

"2018-05-21 21:01:10",WIFI DISCONNECTED
"2018-05-21 21:01:12",WIFI DISCONNECTED
"2018-05-21 21:01:15",WIFI DISCONNECTED
"2018-05-21 21:01:17",WIFI DISCONNECTED
"2018-05-21 21:01:20",WIFI DISCONNECTED
"2018-05-21 21:01:22",WIFI DISCONNECTED
"2018-05-21 21:01:24",WIFI DISCONNECTED
"2018-05-21 21:01:27",WIFI DISCONNECTED
"2018-05-21 21:01:29",WIFI DISCONNECTED
"2018-05-21 21:01:32",WIFI DISCONNECTED
"2018-05-21 21:01:34",WIFI DISCONNECTED
"2018-05-21 21:01:35",OK
"2018-05-21 21:01:35",OK
"2018-05-21 21:01:35",OK
"2018-05-21 21:01:36",OK
"2018-05-21 21:01:36",DEFAULTS
"2018-05-21 21:01:36",Connecting to
"2018-05-21 21:01:36",My_ssid
"2018-05-21 21:01:36",FAIL TO CONNECT

"2018-05-21 21:01:36",OK
"2018-05-21 21:01:36",OK
"2018-05-21 21:01:36",OK
"2018-05-21 21:01:37",WIFI DISCONNECTED
"2018-05-21 21:01:37",OK
"2018-05-21 21:01:37",DEFAULTS
"2018-05-21 21:01:37",Connecting to
"2018-05-21 21:01:37",My_ssid
"2018-05-21 21:01:37",FAIL TO CONNECT

"2018-05-21 21:01:37",OK
"2018-05-21 21:01:37",OK
"2018-05-21 21:01:37",OK
"2018-05-21 21:01:38",OK
"2018-05-21 21:01:38",DEFAULTS
"2018-05-21 21:01:38",Connecting to
"2018-05-21 21:01:38",My_ssid
"2018-05-21 21:01:38",FAIL TO CONNECT

Re: ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Thu May 24, 2018 12:22 pm
by bk@iot
Hello @david,
Did u got the resolution..???
I also getting the same issue with esp32 on esp-idf v3.0..plz let me know..Thanks in advance.

Re: ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Fri May 25, 2018 9:03 am
by ESP_Alvin
Hi,

Could you help print the WiFi disconnect reason? And capture some WiFi packets if you are able to do this.

Thanks

Re: ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Fri May 25, 2018 12:42 pm
by david@mandy
ESP_Alvin wrote:Hi,

Could you help print the WiFi disconnect reason? And capture some WiFi packets if you are able to do this.

Thanks
Hi ESP_Alvin,

How to capture the WiFi packets and how to get the WiFi disconnect reason?
Because it looks like the above log that I shared is not giving enough information and that is all I am getting.
Please let me know if there is anything I have to enable to get a detailed log.

Thanks.

Re: ESP32 getting disconnected after some data transaction with AZURE IOT

Posted: Sun May 27, 2018 2:58 am
by littlesky
First, you need a WiFi card which can capture WiFi packets. Second, install software Omnipeek or Wireshark on your PC. Then you can use it to capture WiFi packets.
The disconnect reason can be obtained when receiving SYSTEM_EVENT_STA_DISCONNECTED event. It is defined in struct in esp_event.h:
typedef struct {
uint8_t ssid[32]; /**< SSID of disconnected AP */
uint8_t ssid_len; /**< SSID length of disconnected AP */
uint8_t bssid[6]; /**< BSSID of disconnected AP */
uint8_t reason; /**< reason of disconnection */
} system_event_sta_disconnected_t;