0

I have a relatively simple ESP32 application using UDP over WiFi and the Arduino IDE. The receiver app is being polled every two seconds by a test app. All datagrams are 5 bytes long. Generally, the receiver responds in about 150ms, but every 5,000 packets or so, the receiver fails to respond until another poll arrives, and then the missing response is received along with the response to the next poll. Initially I though I was losing UDP packets on the WiFi, but it seems that sometimes a received packet is not received until "bumped" by the next received poll.

Datagram arrival is being monitored as follows

  pktSize = udp.parsePacket();

pktSize is not set non-zero very occasionally until another packet arises.

On a hunch, I've replace the #include "WiFi.h" with #include "esp_wifi.h" which seems to fix the problem, and also reduce the response time to a poll from about 150ms to 60ms.

Does anyone have any idea of what is going on? What is the difference between "Wifi.h" and "esp_wifi.h" - Most esp32 apps I see seem to use "WiFi.h"?

Thanks

SteveJP
  • 213
  • 2
  • 8
  • If you care to post a complete program, someone may be able to help you. Otherwise you're asking us to guess as to what else your program does. Actually providing code is infinitely more helpful than describing it. – romkey Nov 22 '20 at 02:01
  • Yes I know that romkey, but I didn't want to put anyone to that trouble. There is quite likely nothing wrong with the code. I'm chasing a problem that others may recognize which is probably related to the WiFi library itself. I showed how I wait for incoming UDP packets which I'm sure is pretty standard. I could post a cut-down version of the code, but the defect only shows every 5,000 to 10,000 polls. who's going to want to debug that. I'm particularly interested in the difference between "wifi.h" and "esp_wifi.h" if anyone knows. I'll be happy if I just get a response to that question. – SteveJP Nov 22 '20 at 04:50

0 Answers0