RTT of examples udp_server and udp_client not very good.

xanthome
Posts: 1
Joined: Sun Jul 14, 2019 6:15 am

RTT of examples udp_server and udp_client not very good.

Postby xanthome » Sun Jul 14, 2019 6:44 am

Hi. I'm using two, ESP32-Wrover-B DevkitC V4. They are sitting on top of my wifi router.

When I compile the esp-idf examples udp_server and udp_client. The RTT varies wildly from 40-200ms

This is not very good.

I have disabled AMPDU, compiled in release mode, set esp32 to 240Mhz.

Anything else I should do to improve this? I do not care about throughput, just latency.

I modified the server code to not print and I modified client to do a breakdown of
send vs receive times using esp_timer_get_time.

From the output below notice how unstable the rtt is
(I'm not in a noisy wifi area and again esp devkits are sitting on top of the router).

That the send alone is not stable and is sometimes taking nearly 2ms is not great either.

I (3219) example: Message sending
I (3429) example: Received 19 bytes from 192.168.86.237, rtt=197355us, send=544us
I (3429) example: Message from ESP32
I (5429) example: Message sending
I (5459) example: Received 19 bytes from 192.168.86.237, rtt=37262us, send=2070us
I (5459) example: Message from ESP32
I (7459) example: Message sending
I (7709) example: Received 19 bytes from 192.168.86.237, rtt=258019us, send=2096us
I (7709) example: Message from ESP32
I (9709) example: Message sending
I (9969) example: Received 19 bytes from 192.168.86.237, rtt=263406us, send=1745us
Attachments
udp_client.c
(6.29 KiB) Downloaded 554 times
sdkconfig-udp_client.txt
(15.85 KiB) Downloaded 529 times
udp_server.c
(6.33 KiB) Downloaded 539 times

jponko
Posts: 2
Joined: Wed Jul 03, 2019 12:27 pm

Re: RTT of examples udp_server and udp_client not very good.

Postby jponko » Fri Aug 09, 2019 11:26 pm

You seem to have better luck than I'm having with the udp_client example program. My attempts at getting it to work have gone nowhere. The udp_client attaches to the wireless router, gets an ip and then says it sent a message but nothing is sent as far as I can tell. I use a program called Packet Sender under Mint 19.2 Linux and I see no message. I tried sending a packet from Packet Sender to the ESP32 and nothing shows up in monitor. I ping the esp32 from my laptop so its not a network problem. I'm using a ESP32-lyrat v4.2 board. I'm trying to get UDP working under wireless AP mode but only UDP server seems to work. Of course, it's an echo server so when I send the ESP32 a packet from Packet Sender it echoes it back.

You'd think that the example programs would just work if they are setup properly. I haven't tried Wireshark at this point but my gut feeling is that it will capture nothing. BTW, I'm using idf v3.2.2. Tried to compile Linux udp client programs but they also fail to work.

Jerry Ponko :(
AC9NM

ESP_sagar
Posts: 9
Joined: Mon Nov 19, 2018 9:55 am

Re: RTT of examples udp_server and udp_client not very good.

Postby ESP_sagar » Wed Aug 14, 2019 12:08 pm

Hi xanthome,
The high RTT is mostly because of WiFi power-save. You can try measuring the RTT by either disabling power save or sending/receiving UDP data at faster rate (timegap between two packets< 50ms) so that wifi does not go into power-save. The power-save mechanism for WiFi can be disabled by using "esp_wifi_set_ps(DEFAULT_PS_MODE)" after esp_wifi_start() and before connection.

Who is online

Users browsing this forum: Baidu [Spider], ok-home and 125 guests