After power-up/restart I initialise ESP8266 as follows:
AT+CWMODE_CUR=3 - set mode "station+softAP"
AT+CWJAP_CUR="MyNetwork","xxxxxxxx" - connect to local network
WIFI GOT IP
AT+CIPMUX=1 - multi-connect mode
AT+CIPSERVER=1,1300 - start TCP server, port 1300
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:
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?
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.
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:
... etc. After a few seconds ESP8266 hangs. The last output from ESP8266 seen by serial monitor is as follows:
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.
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!
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.
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?
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.
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.
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 3 guests
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
We also have a RTOS version and a MESH version too!
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!