Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow RTT on Ping to ESP32 #1484

Closed
janneslr opened this issue Jun 11, 2018 · 21 comments
Closed

Slow RTT on Ping to ESP32 #1484

janneslr opened this issue Jun 11, 2018 · 21 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@janneslr
Copy link

Hi, is there any reason why I have such a slow Round Trip Time on a ping to my ESP32. It varies from 1ms to 700ms and sometime timeouts. Anyone else with this problem?
Reply from 10.168.3.181: bytes=32 time=119ms TTL=255
Reply from 10.168.3.181: bytes=32 time=25ms TTL=255
Reply from 10.168.3.181: bytes=32 time=67ms TTL=255
Reply from 10.168.3.181: bytes=32 time=87ms TTL=255
Reply from 10.168.3.181: bytes=32 time=103ms TTL=255
Reply from 10.168.3.181: bytes=32 time=102ms TTL=255
Reply from 10.168.3.181: bytes=32 time=115ms TTL=255
Reply from 10.168.3.181: bytes=32 time=24ms TTL=255
Reply from 10.168.3.181: bytes=32 time=43ms TTL=255
Reply from 10.168.3.181: bytes=32 time=49ms TTL=255
Reply from 10.168.3.181: bytes=32 time=63ms TTL=255
Reply from 10.168.3.181: bytes=32 time=84ms TTL=255
Reply from 10.168.3.181: bytes=32 time=112ms TTL=255
Reply from 10.168.3.181: bytes=32 time=94ms TTL=255
Reply from 10.168.3.181: bytes=32 time=142ms TTL=255
Reply from 10.168.3.181: bytes=32 time=21ms TTL=255

See the averages:
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 1037ms, Average = 64ms

If I compare to my ESP8266:
Reply from 10.168.3.114: bytes=32 time=4ms TTL=128
Reply from 10.168.3.114: bytes=32 time=13ms TTL=128
Reply from 10.168.3.114: bytes=32 time=6ms TTL=128
Reply from 10.168.3.114: bytes=32 time=3ms TTL=128
Reply from 10.168.3.114: bytes=32 time=3ms TTL=128
Reply from 10.168.3.114: bytes=32 time=4ms TTL=128
Reply from 10.168.3.114: bytes=32 time=8ms TTL=128
Reply from 10.168.3.114: bytes=32 time=5ms TTL=128
Reply from 10.168.3.114: bytes=32 time=17ms TTL=128
Reply from 10.168.3.114: bytes=32 time=4ms TTL=128

Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 17ms, Average = 6ms

@enly1
Copy link

enly1 commented Jun 12, 2018

Just started playing with an ESP32 and have similar performance ( 50 cm from wifi router )

64 bytes from 192.168.1.97: icmp_seq=57 ttl=255 time=194 ms
64 bytes from 192.168.1.97: icmp_seq=58 ttl=255 time=115 ms
64 bytes from 192.168.1.97: icmp_seq=59 ttl=255 time=36.0 ms
64 bytes from 192.168.1.97: icmp_seq=60 ttl=255 time=266 ms
64 bytes from 192.168.1.97: icmp_seq=61 ttl=255 time=184 ms
64 bytes from 192.168.1.97: icmp_seq=62 ttl=255 time=102 ms
64 bytes from 192.168.1.97: icmp_seq=63 ttl=255 time=22.2 ms
64 bytes from 192.168.1.97: icmp_seq=64 ttl=255 time=250 ms
64 bytes from 192.168.1.97: icmp_seq=65 ttl=255 time=170 ms
64 bytes from 192.168.1.97: icmp_seq=66 ttl=255 time=89.6 ms
64 bytes from 192.168.1.97: icmp_seq=67 ttl=255 time=319 ms
64 bytes from 192.168.1.97: icmp_seq=68 ttl=255 time=245 ms
64 bytes from 192.168.1.97: icmp_seq=69 ttl=255 time=164 ms
64 bytes from 192.168.1.97: icmp_seq=70 ttl=255 time=81.0 ms
64 bytes from 192.168.1.97: icmp_seq=71 ttl=255 time=311 ms
64 bytes from 192.168.1.97: icmp_seq=72 ttl=255 time=230 ms
64 bytes from 192.168.1.97: icmp_seq=73 ttl=255 time=154 ms
64 bytes from 192.168.1.97: icmp_seq=74 ttl=255 time=71.6 ms
64 bytes from 192.168.1.97: icmp_seq=75 ttl=255 time=299 ms
64 bytes from 192.168.1.97: icmp_seq=76 ttl=255 time=220 ms
64 bytes from 192.168.1.97: icmp_seq=77 ttl=255 time=141 ms
64 bytes from 192.168.1.97: icmp_seq=78 ttl=255 time=62.3 ms
64 bytes from 192.168.1.97: icmp_seq=79 ttl=255 time=288 ms
64 bytes from 192.168.1.97: icmp_seq=80 ttl=255 time=209 ms
64 bytes from 192.168.1.97: icmp_seq=81 ttl=255 time=131

Running Simple Wifi Server example sketch on Arduino.

@1163167506
Copy link

ye
You and I have the same problem.

I and espressif official trench admit that esp32 has this problem through them.

But I don't have time to wait for the official solution.

Can anyone offer good advice

@1163167506
Copy link

I solved this problem
Because esp32 enters the power saving mode by default, just set it up.

WiFi.mode (WIFI_STA);

Esp_wifi_set_ps (WIFI_PS_NONE);

WiFi.begin (ssid3, password3);

@janneslr
Copy link
Author

I can confirm adding the Esp_wifi_set_ps (WIFI_PS_NONE); line of code worked. Thanks!!!

@lbernstone
Copy link
Contributor

If it is fixed, please close the issue.

@me-no-dev
Copy link
Member

it worked but it consumes more power ;) in essence you are keeping the esp awake and wifi on all of the time

@SteveAmor
Copy link

SteveAmor commented Jul 29, 2018

To use esp_wifi_set_ps (WIFI_PS_NONE); you also need #include "esp_wifi.h" (worked for me in Arduino IDE).

@lbernstone
Copy link
Contributor

If you use WiFi.setSleep(false), you will need no additional libraries.

@Uksa007
Copy link

Uksa007 commented Jul 31, 2018

I noticed I have this issue also, confirmed that turning off the power save fixes the issue, but it seems like a bit of a hack.

I note that on my ESP8266 the Wifi power save is automatically turned off when the ESP8266 is communitcing over the WIFI and then turned back on again, which make sense to me, and is how most Wifi devices work.
Why does the ESP32 WIFI not fuction in this way?

@vinot
Copy link

vinot commented Jul 12, 2019

Hi all,

thank you a lot for the solution, was frustrating those 200ms ping...

yrs

toni

@dao89
Copy link

dao89 commented Jul 13, 2019

I noticed I have this issue also, confirmed that turning off the power save fixes the issue, but it seems like a bit of a hack.

I note that on my ESP8266 the Wifi power save is automatically turned off when the ESP8266 is communitcing over the WIFI and then turned back on again, which make sense to me, and is how most Wifi devices work.
Why does the ESP32 WIFI not fuction in this way?

One year past, but ESP32 still very slow when power saving not disabled. When disabled, it consumes twice more power! esp8266 doesn't have such problem... It is very sad.
Maybe there is some solution?

@stale
Copy link

stale bot commented Sep 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Sep 11, 2019
@stale
Copy link

stale bot commented Sep 25, 2019

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Sep 25, 2019
@YordanYanakiev
Copy link

It turns out that this resoled actually ALL of the issues connected to the WebServer random connection drops. So - link this topic to all of such issues. It most likely if not solve totally it will at lease easy the problem.

tschundler added a commit to tschundler/Grbl_Esp32 that referenced this issue Dec 19, 2020
before:
```
$ ping 192.168.1.17
PING 192.168.1.17 (192.168.1.17) 56(84) bytes of data.
64 bytes from 192.168.1.17: icmp_seq=1 ttl=255 time=82.1 ms
64 bytes from 192.168.1.17: icmp_seq=3 ttl=255 time=81.0 ms
64 bytes from 192.168.1.17: icmp_seq=5 ttl=255 time=1410 ms
64 bytes from 192.168.1.17: icmp_seq=6 ttl=255 time=386 ms
```

after:
```
$ ping 192.168.1.17
PING 192.168.1.17 (192.168.1.17) 56(84) bytes of data.
64 bytes from 192.168.1.17: icmp_seq=1 ttl=255 time=159 ms
64 bytes from 192.168.1.17: icmp_seq=2 ttl=255 time=9.77 ms
64 bytes from 192.168.1.17: icmp_seq=3 ttl=255 time=5.81 ms
64 bytes from 192.168.1.17: icmp_seq=4 ttl=255 time=48.0 ms
64 bytes from 192.168.1.17: icmp_seq=5 ttl=255 time=6.70 ms
64 bytes from 192.168.1.17: icmp_seq=6 ttl=255 time=6.36 ms
```

see also: espressif/arduino-esp32#1484
@LockonS
Copy link

LockonS commented Sep 3, 2021

If you use WiFi.setSleep(false), you will need no additional libraries.

WORKS LIKE A CHARM! Thannk you so much.

@mbratch
Copy link

mbratch commented Mar 29, 2022

The ping response on my ESP32 running with ESP-IDF 4.4 seems to be relatively long and vary quite a bit. Unclear why this is the case.
image

@gonzabrusco
Copy link
Contributor

The correct way to do this is WiFi.setSleep(WIFI_PS_NONE);

The wifi energy saving options are:

 WIFI_PS_NONE,        /**< No power save */
 WIFI_PS_MIN_MODEM,   /**< Minimum modem power saving. In this mode, station wakes up to receive beacon every DTIM period */
 WIFI_PS_MAX_MODEM,   /**< Maximum modem power saving. In this mode, interval to receive beacons is determined by the listen_interval parameter in wifi_sta_config_t */

@mbratch
Copy link

mbratch commented Apr 29, 2022

The correct way to do this is WiFi.setSleep(WIFI_PS_NONE);

That's using the Arduino WiFi library. I am not using Arduino, but rather ESP-IDF.

For ESP-IDF, the correct call is esp_wifi_set_ps(WIFI_PS_NONE); This is what I am using and I still observe slower ping responses than I would have expected.

@gonzabrusco
Copy link
Contributor

The correct way to do this is WiFi.setSleep(WIFI_PS_NONE);

That's using the Arduino WiFi library. I am not using Arduino, but rather ESP-IDF.

For ESP-IDF, the correct call is esp_wifi_set_ps(WIFI_PS_NONE); This is what I am using and I still observe slower ping responses than I would have expected.

Well, this is the arduino-esp32 repository, thus my comment is directed to Arduino users. If you have a problem with IDF, you better submit an issue in the IDF repository (https://github.com/espressif/esp-idf)

@mbratch
Copy link

mbratch commented Apr 30, 2022

@gonzabrusco ha indeed. I've been working with several esp32 related repositories lately and got my wires crossed a little! My apologies.

Under the hood, as it were, the Arduino library probably calls the esp-idf API. Definitely not an Arduino specific issue

@gonzabrusco
Copy link
Contributor

@gonzabrusco ha indeed. I've been working with several esp32 related repositories lately and got my wires crossed a little! My apologies.

Under the hood, as it were, the Arduino library probably calls the esp-idf API. Definitely not an Arduino specific issue

No need to apologize! Yes, actually Arduino calls the IDF function you menctioned.

if(esp_wifi_set_ps(_sleepEnabled) != ESP_OK){

But now that I see, the function that accepts a boolean (as mentioned previously) actually exists too!

bool WiFiGenericClass::setSleep(bool enabled){

But it let's you only chose between two types of energy savings (off or minimal).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests