[Closed] Flow control resets Esp8266

gusa
Posts: 4
Joined: Tue Feb 14, 2017 5:36 pm

[Closed] Flow control resets Esp8266

Postby gusa » Mon Feb 20, 2017 8:53 pm

Hello,
I am using ESP8266EX :

Code: Select all

AT version:1.3.0.0(Jul 14 2016 18:54:01)
SDK version:2.0.0(656edbf)
compile time:Jul 19 2016 18:44:22


I want to use flow control to receive as fast as possible without data loss. I am using CTS pin to stop receiving when the program behind the ESP8266 can´t handle data. On this way when I want more data I enable CTS.

In order to do that I am using next AT commands in the ESP8266:

Code: Select all

AT+CWMODE=1
AT+CWJAP="MYWIFI","PASSWORD"
AT+UART_CUR=115200,8,1,0,2
AT+CIPSTART="TCP","MY_IP",MY_PORT


It is connecting to a NetCat to receive as much data as possible.

Code: Select all

type veryBigFile.txt | nc -l -p MY_PORT


In my program that is connected to the ESP using AT commands and serial port I see data until 25Kb are sent, more or less. After that the ESP-8266 lose the wifi connection. I think the Esp8266 is reset by some issue.

Code: Select all

CLOSED
WIFI DISCONNECT
WIFI CONNECTED
WIFI GOT IP


What am I missing? Is it possible to do in a different way?

Kind regards.

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

Re: Flow control resets Esp8266

Postby ESP_Faye » Fri Mar 24, 2017 9:39 am

Hi,

Sorry that we cannot duplicate your problem, could you provide UART1 log for debugging?

Thanks for your interest in ESP8266!

gusa
Posts: 4
Joined: Tue Feb 14, 2017 5:36 pm

Re: Flow control resets Esp8266

Postby gusa » Tue Apr 11, 2017 5:52 pm

Hello:

What I see is the file I attached. Is there some way to put the esp in debug mode?

I am using a ESP-01 using a serial-usb converter.

Please, could you let me know how you are testing the esp?.

Kind regards.
Attachments
Log1.zip
(90.58 KiB) Downloaded 838 times

Her Mary
Posts: 537
Joined: Mon Oct 27, 2014 11:09 am

Re: Flow control resets Esp8266

Postby Her Mary » Wed Apr 12, 2017 9:59 am

“CLOSE” means that the TCP connection is closed, maybe closed by your TCP server. You can capture the TCP packets by wireshark or omnipeek to find out it.

gusa
Posts: 4
Joined: Tue Feb 14, 2017 5:36 pm

Re: Flow control resets Esp8266

Postby gusa » Wed Apr 12, 2017 5:13 pm

Hello,

Thank you very much for your answer. Indeed you are true. The problem here was that the timeout in the server was really low so the Esp didn´t process the packages fast enough for ther server. Increasing timeout fixed the problem.

However it was for 64Kb file. I wanted to transmit big files so I moved to 560Kb file size. I have increased server timeout

Code: Select all

type veryBigFile.txt | nc -l -p MY_PORT -w 10000000


What I see here, please correct me if I am wrong, is that the ESP tells that the server mustn´t send more packages "Len=0", after that server requests for retransmision. And what has changed is the fact that the ESP is requesting for reset in the last package.

Code: Select all

No.     Time           Source                Destination           Protocol Length Info
  13315 66.901809      ESP-IP                SERVER-IP             TCP      60     2996 → 1234 [ACK] Seq=1 Ack=335801 Win=1460 Len=0


No.     Time           Source                Destination           Protocol Length Info
  13356 67.275402      SERVER-IP             ESP-IP                 TCP      1514   [TCP Window Full] [TCP Retransmission] 1234 → 2996 [ACK] Seq=335801 Ack=1 Win=64240 Len=1460

No.     Time           Source                Destination           Protocol Length Info
  13444 67.947298      SERVER-IP             ESP-IP                 TCP      1514   [TCP Window Full] [TCP Retransmission] 1234 → 2996 [ACK] Seq=335801 Ack=1 Win=64240 Len=1460

No.     Time           Source                Destination           Protocol Length Info
  13704 69.275521      SERVER-IP             ESP-IP                 TCP      1514   [TCP Window Full] [TCP Retransmission] 1234 → 2996 [ACK] Seq=335801 Ack=1 Win=64240 Len=1460

No.     Time           Source                Destination           Protocol Length Info
  14346 71.916089      SERVER-IP             ESP-IP                 TCP      1514   [TCP Window Full] [TCP Retransmission] 1234 → 2996 [ACK] Seq=335801 Ack=1 Win=64240 Len=1460

No.     Time           Source                Destination           Protocol Length Info
  15499 77.181806      SERVER-IP             ESP-IP                 TCP      1514   [TCP Window Full] [TCP Retransmission] 1234 → 2996 [ACK] Seq=335801 Ack=1 Win=64240 Len=1460

No.     Time           Source                Destination           Protocol Length Info
  15501 77.187062      ESP-IP                SERVER-IP             TCP      60     2996 → 1234 [RST, ACK] Seq=1 Ack=337261 Win=2920 Len=0



The Esp serial port output is:

Code: Select all

[...]
+IPD,1459:ue nunc sed convallis ultricies. Nam malesuada nulla ac suscipit [...] Quisque cursus nulla non turpis dignissim
CLOSED
WIFI DISCONNECT
WIFI CONNECTED
WIFI GOT IP


Why is the WIFI DISCONNECT ?

Kind regards and thank you for your help.

Her Mary
Posts: 537
Joined: Mon Oct 27, 2014 11:09 am

Re: Flow control resets Esp8266

Postby Her Mary » Fri Apr 14, 2017 2:32 pm

The captured packet is kind of strange, did you miss some packets?
[TCP window full] means that you send data too fast that the ESP cannot receive,
but there should be [TCP zerowindow] to tell the server to slow down.
The last [RST, ACK] is the ESP to close the TCP connection.
And the WiFi should not disconnect, is it the network condition too bad so the connection break? Maybe you can try it again with another router.

gusa
Posts: 4
Joined: Tue Feb 14, 2017 5:36 pm

Re: Flow control resets Esp8266

Postby gusa » Thu Apr 20, 2017 7:33 pm

Hello:

Thank you very much for your answer. I did miss some packages. I have just copied just what I thought were interesting.

The connection network is right, I tried with an SMC Barricade router. I think this is the main problem. After that I tried with a different router brand and is working properly.

Please, consider this topic as closed. It is woking properly for me.

Kind regards and thank you for your help.

Who is online

Users browsing this forum: No registered users and 4 guests