TCP Slow, then disconnects, UDP Slow

petermccloud
Posts: 6
Joined: Wed Nov 22, 2017 8:24 pm

TCP Slow, then disconnects, UDP Slow

Postby petermccloud » Fri Nov 24, 2017 7:09 am

I am experiencing very slow TCP and UDP speeds between 2 Sparkfun ESP32 Thing boards. In addition the the TCP being slow, it disconnects very quickly.

The first test was using the iperf example under master https://github.com/espressif/esp-idf/tr ... wifi/iperf
Compiled with master/commit 597ce3b800cc4857e1939bbb937610a9e30c6e72

Testing with TCP, the output shows an initial slow connection then the speed goes to zero

Code: Select all

I (52003) iperf: mode=tcp-client sip=192.168.4.2:5001, dip=192.168.4.1:5001, interval=3, time=30
esp32>  
        Interval Bandwidth
   0-   3 sec       0.35 Mbits/sec
   3-   6 sec       0.00 Mbits/sec
   6-   9 sec       0.00 Mbits/sec
   9-  12 sec       0.00 Mbits/sec
  12-  15 sec       0.00 Mbits/sec
  15-  18 sec       0.00 Mbits/sec
  18-  21 sec       0.00 Mbits/sec
  21-  24 sec       0.00 Mbits/sec
  24-  27 sec       0.00 Mbits/sec
  27-  30 sec       0.00 Mbits/sec
   0-  30 sec       0.03 Mbits/sec
I (82027) iperf: iperf exit
Testing with UDP is just slow (according to https://github.com/espressif/esp-idf/issues/322, is should be 130. I get ~1.4.

Code: Select all

I (429604) iperf: mode=udp-client sip=192.168.4.2:5001, dip=192.168.4.1:5001, interval=3, time=30
esp32> 
        Interval Bandwidth
   0-   3 sec       1.54 Mbits/sec
   3-   6 sec       1.31 Mbits/sec
   6-   9 sec       1.45 Mbits/sec
   9-  12 sec       1.31 Mbits/sec
  12-  15 sec       1.48 Mbits/sec
  15-  18 sec       1.34 Mbits/sec
  18-  21 sec       1.44 Mbits/sec
  21-  24 sec       1.33 Mbits/sec
  24-  27 sec       1.44 Mbits/sec
  27-  30 sec       1.33 Mbits/sec
   0-  30 sec       1.40 Mbits/sec
I (459633) iperf: iperf exit
I also did further tests using the performance examples: https://github.com/espressif/esp-idf/tr ... erformance
and got similar results.
TCP

Code: Select all

TCP
I (29568) tcp_perf:: connecting to server...
I (29608) tcp_perf:: connect to server success!
I (32608) tcp_perf:: tcp recv 3829 byte per sec!
W (35608) tcp_perf:: tcp disconnected... stop.
UDP

Code: Select all

I (50131) udp_perf:: udp send 88573 byte per sec! total pack: 182
...
I (173131) udp_perf:: udp send 89546 byte per sec! total pack: 7623
I also did testing using the latest release v2.1.1. Since iperf is not part of v2.1.1, I didn't run it, but I did run the TCP and UDP examples and got similar results.

TCP

Code: Select all

I (11688) tcp_perf:: sta has connected to ap.
I (11698) tcp_perf:: tcp_server will start after 3s...
I (14708) tcp_perf:: create_tcp_server.
I (14708) tcp_perf:: server socket....port=4567

I (32418) tcp_perf:: tcp connection established!
I (32518) tcp_perf:: start sending...
I (35418) tcp_perf:: tcp send 5840 byte per sec!
W (38418) tcp_perf:: tcp disconnected... stop.
I've been researching and battling these slow issues for a few days now and I'm out of options. I'm starting to wonder if I got some bad hardware. I have 5 boards and all of them show the same behavior. Any ideas would be appreciated.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: TCP Slow, then disconnects, UDP Slow

Postby WiFive » Fri Nov 24, 2017 7:29 am

Try 3.0-dev version i think there are some phy fixes for 26mhz crystal that sparkfun uses

petermccloud
Posts: 6
Joined: Wed Nov 22, 2017 8:24 pm

Re: TCP Slow, then disconnects, UDP Slow

Postby petermccloud » Fri Nov 24, 2017 6:02 pm

WiFive wrote:Try 3.0-dev version i think there are some phy fixes for 26mhz crystal that sparkfun uses
Thanks for the suggestion WiFive! I tried out 3.0-dev. It initially gave me the same output. However, your comment led me to look at the XTAL freq in closer detail. I had been setting XTAL freq to Auto. I tried setting it to 26MHz directly and got a different result.

XTAL set to Autoconfig

Code: Select all

I (28019) tcp_perf:: sta has connected to ap.
I (28029) tcp_perf:: tcp_server will start after 3s...
I (31029) tcp_perf:: create_tcp_server.
I (31029) tcp_perf:: server socket....port=4567

I (48739) tcp_perf:: tcp connection established!
I (48849) tcp_perf:: start sending...
I (51749) tcp_perf:: tcp send 4866 byte per sec!
W (54749) tcp_perf:: tcp disconnected... stop.
XTAL set to 26MHZ

Code: Select all

I (88180) tcp_perf:: tcp connection established!
I (88280) tcp_perf:: start sending...
I (91180) tcp_perf:: tcp send 46233 byte per sec!
I (94180) tcp_perf:: tcp send 53533 byte per sec!
I (97180) tcp_perf:: tcp send 54020 byte per sec!
I (100180) tcp_perf:: tcp send 49640 byte per sec!
I (103180) tcp_perf:: tcp send 50613 byte per sec!
I (106180) tcp_perf:: tcp send 51586 byte per sec!
The speed was about 10x faster and the tcp connection doesn't drop. I went back to master and set XTAL to 26MHz. It doesn't disconnect the TCP connection, but the speeds are intermittent....

master branch, XTAL set to 26MHZ

Code: Select all

I (8207) tcp_perf:: sta has connected to ap.
I (8207) tcp_perf:: tcp_server will start after 3s...
I (11217) tcp_perf:: create_tcp_server.
I (11217) tcp_perf:: server socket....port=4567

I (28987) tcp_perf:: tcp connection established!
I (29087) tcp_perf:: start sending...
I (31987) tcp_perf:: tcp send 46720.00 byte per sec!
I (34987) tcp_perf:: tcp send 0.00 byte per sec!
I (37987) tcp_perf:: tcp send 0.00 byte per sec!
I (40987) tcp_perf:: tcp send 0.00 byte per sec!
I (43987) tcp_perf:: tcp send 0.00 byte per sec!
I (46987) tcp_perf:: tcp send 19466.67 byte per sec!
I (49987) tcp_perf:: tcp send 7786.67 byte per sec!
I (52987) tcp_perf:: tcp send 0.00 byte per sec!
I (55987) tcp_perf:: tcp send 0.00 byte per sec!
I (58987) tcp_perf:: tcp send 0.00 byte per sec!
I (61987) tcp_perf:: tcp send 3893.33 byte per sec!
I (64987) tcp_perf:: tcp send 0.00 byte per sec!
I'm going to do some more testing with iperf with XTAL set to 26 MHz and see if I get different results.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: TCP Slow, then disconnects, UDP Slow

Postby WiFive » Sat Nov 25, 2017 2:32 am

Did you try a make erase_flash before switching to 3.0?

petermccloud
Posts: 6
Joined: Wed Nov 22, 2017 8:24 pm

Re: TCP Slow, then disconnects, UDP Slow

Postby petermccloud » Sat Nov 25, 2017 3:36 am

WiFive wrote:Did you try a make erase_flash before switching to 3.0?
Yes. To help isolate the issue, I've been doing a make erase_flash before every time I switch IDF and toolchains to help make sure I've got a clean firmware. For some reason, it looks like my earlier test with v3.0-dev and XTAL set to 26MHz was a fluke. After testing on the master I switched back to v3.0-dev with XTAL set to 26MHz and the same behavior is occurring again. I've tried a few more flashes and the occasional erase_flash and I'm not able to reproduce the results.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: TCP Slow, then disconnects, UDP Slow

Postby WiFive » Sat Nov 25, 2017 3:50 am

Sorry master branch should be the better version, I didn't realize 3.0-dev tag was so out of date

petermccloud
Posts: 6
Joined: Wed Nov 22, 2017 8:24 pm

Re: TCP Slow, then disconnects, UDP Slow

Postby petermccloud » Tue Dec 26, 2017 5:30 am

Just following up on this thread and documenting my results. I bought a set of Adafruit Huzzah32 boards and they had no issues sending TCP and UDP. I stopped using my Sparkfun ESP32 Thing. I would recommend to anyone who wants to use the ESP-IDF, don't get the Sparkfun board.

grtschnk
Posts: 2
Joined: Sun May 13, 2018 12:08 am

Re: TCP Slow, then disconnects, UDP Slow

Postby grtschnk » Sun May 13, 2018 12:35 am

I ran into similar issues using Sparkfun ESP32 Thing boards: the WiFi (UDP and TCP) performance is really bad. Only 10% of what users can expect. I will post the serial output once I am back in my workshop.

For now, I ordered Adafruit boards, let's see if this helps.

However: Is there more information on the root cause/exact issue why some users experience poorly performing Sparkfun boards? Is it a hardware or software issue, or both? Did they screw up the antenna or something like that? (I once had to "fix" a RobotDyn board by jamming a paperclip into the antenna jack) I am hoping that at some point I can (re)use the Sparkfun boards (my projects will need good WiFi).
I know about the different XTAL frequency, 26 MHz instead of 40 MHz, and that in previous releases it might have caused a bug. Is this still an issue in terms of WiFi performance? I can establish the connection(s) but the throughput/bandwidth is just so bad I cannot use it for my project.

And to end on a good note: Thank you for all the nice hardware and software ;)

digsub
Posts: 14
Joined: Sat Apr 22, 2017 9:17 am

Re: TCP Slow, then disconnects, UDP Slow

Postby digsub » Wed Feb 27, 2019 8:51 am

My prototype with Sparkfun ESP32 thing seems to have room for TCP/UDP improvement and Sparkfun tech support had no info.

So, any update on this issue concerning Sparkfun ESP32 thing or other boards such as Adafruit Huzzah32 or WEMOS LoLin32?

btw I'm using the Arduino IDE not ESP-IDF.

Thanks.

Who is online

Users browsing this forum: No registered users and 118 guests