Page 1 of 1

Wifi: sendto returns correctly, but the message does not arrive on the PC

Posted: Tue Oct 30, 2018 2:39 pm
by belinea123
I use a UDP server on a ESP32 on the wifi interface. Sometimes, when I call sendto, the function returns correctly, but the message does not arrive on the PC.

Here are more details:
I use the ethernet of the ESP32 to communicate with a different processor. I set up a gateway: When the PC sends packets via wifi, they are received on a socket by the ESP32. Then, it forwards the packets via ethernet on a different socket. The other way around: When the second processor sends a packet to the ESP32, it is received and sent over the wifi socket to the PC.

I send a file via TFTP from the PC to the ESP32. In one of five tries, the TFTP transfer fails. The analysis showed that the PC sends a data packet. It is forwarded to the second processor by the ESP32. The second processor works on the data packet and sends an ACK packet. The ACK packet is received by the ESP32, it calls sendto successfully, but the ACK packet does not arrive at the PC. I used wireshark for the analysis. The PC retries to send the data packet for three times, but the sendto calls do not arrive. After that, the ESP32 does not respond to pings on the wifi side for several seconds. But I see, that the ESP32 responds to pings on the ethernet side during this period. After several seconds, the ESP32 responds to pings on the wifi side again.

I use the Pycom W01, which integrates the ESP32.

I set the log level to verbose, but no suspicious log output was printed. I see no event SYSTEM_EVENT_AP_STADISCONNECTED/SYSTEM_EVENT_AP_STACONNECTED. The message load is about one sendto on wifi side every 20ms.

Code: Select all

max_connection=1
channel=1
authmode=WIFI_AUTH_WPA2_PSK
beacon_interval=1000
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ret = esp_wifi_set_mode(WIFI_MODE_AP);
ret = esp_wifi_set_config(ESP_IF_WIFI_AP, &config_from_nvs);
ret = esp_wifi_set_protocol(ESP_IF_WIFI_AP, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N);
ret = esp_wifi_start();

Re: Wifi: sendto returns correctly, but the message does not arrive on the PC

Posted: Mon Nov 05, 2018 2:37 pm
by belinea123
I switched to esp-idf-v3.1_rel, but I still have the same problem. Any ideas?