Cannot connect to ESP8266 after a while
Cannot connect to ESP8266 after a while
Postby akouz » Mon Aug 15, 2016 2:07 pm
After power-up/restart I initialise ESP8266 as follows:
AT+CWMODE_CUR=3 - set mode "station+softAP"
OK
AT+CWJAP_CUR="MyNetwork","xxxxxxxx" - connect to local network
WIFI CONNECTED
WIFI GOT IP
OK
AT+CIPMUX=1 - multi-connect mode
OK
AT+CIPSERVER=1,1300 - start TCP server, port 1300
OK
After that ESP8266 works quite well. I can broadcast UDP messages, or I can serve TCP requests coming from softAP network or from local network. It can be HTTP requests from a browser, or binary messages from custom software. I can access it from my mobile phone, from my desktop or from laptop, no problems.
But it does not work for long. After a few hours ESP8266 may continue to serve TCP request from one computer and refuses to make TCP connectoins to other computers. It continues to send UDP messages, it may serve HTTP requests in softAP network, but in the local network it talks to one and only one computer, refusing to make connection to any other computer. Say, on my desktop I can access ESP8266 TCP server via browser or via custom software. But I cannot access it from other computers in the local network. Other computers just wait for connection for long time and then finish by time-out. ESP8266 does not show any AT commands or echo when I try to connect from other computers, but it shows expected traffic when I connect my desktop computer.
I tried to reset TCP server:
AT+CIPSERVER=0
AT+CIPSERVER=1,1300
That does not help.
If I restart module by AT+RST and then re-initialise it, everything works again. For a while.
What is wrong?
Re: Cannot connect to ESP8266 after a while
Postby pratik » Mon Aug 15, 2016 7:26 pm
Could you please use AT+GMR and inform about the SDK/firmware version? Also, have you added custom AT commands to the firmware?
When you face this problem that you described, please use AT+RST and then see if the problem is resolved or not. If resolved, then probably a software issue. Otherwise may be hardware/network issue.
Re: Cannot connect to ESP8266 after a while
Postby akouz » Tue Aug 16, 2016 8:00 am
SDK version:1.5.2(80914727)
There is one custom AT command there, AT+RADC. It reads ADC.
As I said above, AT+RST command solves the problem, but it solves it for a while only. After few hours the same problem appears again.
We are trying to reproduce the problem in shorter time. We run test programs on PC. One of the test programs does a rather simple job:
- Open TCP connection
- Send 3 bytes of binary data
- Close TCP connection.
Test program does it at maximum speed using 30 threads. Apparently PC is much faster than ESP8266, and WiFi is much faster than serial port at 115 kbps. Thus, I would expect that the operations speed should be defined by ESP8266 reactions. If ESP requires some time to receive data and send them via UART, it may wait before opening a new TCP connection. Measured throughput is about 600 bytes per second, thus, ESP processes about 200 transactions per second
The following is a sample of ESP8266 output seen by serial monitor:
0,CONNECT
+IPD,0,3:<...>0,CLOSED
0,CONNECT
1,CONNECT
+IPD,1,3:<...>1,CLOSED
+IPD,0,3:<...>0,CLOSED
... etc. After a few seconds ESP8266 hangs. The last output from ESP8266 seen by serial monitor is as follows:
+IPD,2,3:<...>3,CONNECT
4,CONNECT
0,CLOSED
0,CONNECT
1,CLOSED
2,CLOSED
1,CONNECT
2,CONNECT
0,CONNECT FAIL
1,CONNECT FAIL
2,CONNECT FAIL
3,CONNECT FAIL
4,CONNECT FAIL
After that ESP8266 output is frozen. It does not react to any AT commands, including AT+RST.
It looks like a seriuos problem, is not it? Anyone can crash ESP8266 via WiFi just by running a similar program on PC.
Re: Cannot connect to ESP8266 after a while
Postby pratik » Wed Aug 17, 2016 10:12 am
If you are reading the ADC anywhere between these connection-disconnection cycles, please substitute that code and use a dummy value. The ADC is closely linked with internal RF circuitry and may cause issues at times if not used properly.
The second option is to simply generate the firmware without any modification to it (no custom AT commands at all) and then try to see if behaves this way again.
Meanwhile, I will have this checked for a memory leak issue (you can also print free system memory every time you connect/disconnect), if it decreases, you probably have a memory bug somewhere!
Re: Cannot connect to ESP8266 after a while
Postby akouz » Wed Aug 17, 2016 10:57 am
Thanks.
Sorry, I do not use the new AT+RADC command at all.
you can also print free system memory every time you connect/disconnect
Please explain how can I do that. I do not know how to print free ESP8266 system memory using AT commands.
Regards
Alex
Re: Cannot connect to ESP8266 after a while
Postby akouz » Tue Aug 23, 2016 3:11 pm
WIFI DISCONNECT
WIFI CONNECTED
WIFI GOT IP
After that connection to network is lost, and softAP does not respond to requests too. It just refuse to connect.
Why could it be?
Re: Cannot connect to ESP8266 after a while
Postby pratik » Tue Aug 23, 2016 3:58 pm
Also, please use the latest firmware. We fix MANY issues with every subsequent update. This might be one of those. v.1.5.x received many patches because of small issues. Therefore, I would recommend upgrading to SDK v.2.0.0 if the problem cannot be resolved.
Re: Cannot connect to ESP8266 after a while
Postby akouz » Fri Aug 26, 2016 6:44 am
Good news: this version does not crash on the "connect - send 3 bytes - disconnect" sequence.
Bad news: this version still refuses to make TCP connections to some computers after about one hour, at random.
ESP8266 is in station+softAP mode, multiple connection mode, it runs TCP server, as described above. In our application we supposed to connect to our device with ESP8266 from any computer in network. Our device runs HTTP server. A browser from any computer in the local network can establish connection to HTTP server and request HTML pages.
After power-up or reset everything works OK.
After about one hour some computers cannot connect to ESP8266. After sending request to ESP8266 their browsers waits and then exit by time-out. ESP8266 UART output does not indicate that connection is established, it is silent, there is no traffic.
The same time other computers still can connect to ESP8266. Its UART output shows messages such as "0,CONNECT" and then incoming HTTP request from the browser.
Re: Cannot connect to ESP8266 after a while
Postby pratik » Fri Sep 02, 2016 10:01 am
Until then, switching to another AT firmware version is recommended, if this is indeed a firmware issue.
Who is online
Users browsing this forum: No registered users and 4 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.