[Solved] Wi-Fi drops after 20-40 seconds

noumes
Posts: 8
Joined: Wed Jan 13, 2016 9:47 am

[Solved] Wi-Fi drops after 20-40 seconds

Postby noumes » Wed Jan 13, 2016 10:56 am

Hi,

Trying to run a simple application on the ESP8266, specifically the Adafruit HUZZAH ESP8266 breakout.

https://github.com/NoumanSaleem/esp8266-hello-world

The application is compiled using https://github.com/pfalcon/esp-open-sdk, under sdk 1.5, and flashed using esptool.py.

After the app starts, I am able to see my request debug output on my serial monitor, however it stops responding between 20-40 seconds on average. After it stops responding, I can then see the device as inactive under my router.

Here is the command I am running:

Code: Select all

while true; do echo -n “fewb” | nc -4u -w1 192.168.1.67 25867; sleep 2; done


To add to the weirdness, if I run a ping in parallel to my command above, everything works fine. Have tested this as working for 5+ minutes.

Any help is greatly appreciated.

noumes
Posts: 8
Joined: Wed Jan 13, 2016 9:47 am

Re: Wi-Fi drops after 20-40 seconds

Postby noumes » Wed Jan 13, 2016 12:29 pm

Have complied using the Espressif provided virtualbox image this time with SDK 1.5.1, and have the same results. Here is the serial output:

connected with iFi, channel 6
dhcp client start...
WiFi Event: 0
ip:192.168.1.67,mask:255.255.255.0,gw:192.168.1.254
IP: 192.168.1.67
Listening for data
Received data!
Received data!
Received data!
Received data!
pm open,type:2 0
Received data!
Received data!
Received data!
Received data!
chg_B1:-40


20 seconds and it stops receiving anything

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Wi-Fi drops after 20-40 seconds

Postby ESP_Faye » Wed Jan 13, 2016 2:20 pm

Hi,

What is the "Received data!" ? A TCP packet ?

Does the ESP8266 in station-only mode ?

Please set ESP8266 in station+softAP mode, and try it again.

Thanks for your interest in ESP8266 !

noumes
Posts: 8
Joined: Wed Jan 13, 2016 9:47 am

Re: Wi-Fi drops after 20-40 seconds

Postby noumes » Thu Jan 14, 2016 11:55 am

Faye,

Thanks for your reply.

I have changed:

Code: Select all

wifi_set_opmode_current(STATION_MODE);

to

Code: Select all

wifi_set_opmode_current(STATIONAP_MODE);


However, I have the same result.

Received data!
is a UDP request callback registered with
espconn_regist_recvcb


In addition, I am also writing the Wifi events

Code: Select all

LOCAL void wifiEventHandler(System_Event_t *event) {
  switch (event->event) {
    case EVENT_STAMODE_GOT_IP:
      os_printf("IP: %d.%d.%d.%d\n", IP2STR(&event->event_info.got_ip.ip));
      setupUDP();
    break;
    default:
      os_printf("WiFi Event: %d\n", event->event);
  }
}
...
wifi_set_event_handler_cb(wifiEventHandler);


I see

Code: Select all

WiFi Event: 7
outputted constantly. My "Received Data" stops after the same duration, around 20 seconds, but the Wifi Event output continues.

The user_main.c can be viewed here: https://github.com/NoumanSaleem/esp8266 ... ser_main.c

Thanks

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Wi-Fi drops after 20-40 seconds

Postby ESP_Faye » Wed Jan 20, 2016 4:49 pm

Hi,

Here is an example of UDP : http://bbs.espressif.com/viewtopic.php?f=31&t=230

Please notice that your "esp_udp udp;" is a local variable, it will be released when "setupUDP()" finish.

noumes
Posts: 8
Joined: Wed Jan 13, 2016 9:47 am

Re: Wi-Fi drops after 20-40 seconds

Postby noumes » Thu Jan 28, 2016 12:13 pm

Thank you very much!

Who is online

Users browsing this forum: No registered users and 190 guests