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

ESP32 does not answer ARP requests #2396

Closed
edalongeville opened this issue Jan 29, 2019 · 8 comments
Closed

ESP32 does not answer ARP requests #2396

edalongeville opened this issue Jan 29, 2019 · 8 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@edalongeville
Copy link

Hardware:

Board: ESP32 Dev Module
Core Installation version: 1.0.1
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Ubuntu

Description:

The ESP32 dos not answer ARP requests.

At startup, the ESP32 sends a gratuitous ARP.
Once ESP32 startup is complete, I flush the arp cache on my Ubuntu machine (sudo ip -s -s neigh flush all) and attempt to ping the ESP32. The ARP requests sent by my machine are left unanswered.

I suspect this is a known issue, as the ESP32 sends gratuitous ARP about once per minute. This works as a temporary workaround, but in some applications, ARP requests need to be answered.

Sketch: (leave the backquotes for code formatting)

//Change the code below by your sketch
#include <WiFi.h>
#include <aREST.h>


// WiFi parameters
String ssid = "MYSSID";
String password= "MYPASSWORD";

#pragma region aRESTandWiFi

// The port to listen for incoming TCP connections
#define LISTEN_PORT           80
// Create an instance of the server
WiFiServer server(LISTEN_PORT);


void setup(void)
{


  // Start Serial
  Serial.begin(115200);

  delay(5000);

  // Connect to WiFi
  Serial.print("Connecting to wifi with ssid/password: " + ssid + "/" + password);
  WiFi.begin(ssid.c_str(), password.c_str());
  while (WiFi.status() != WL_CONNECTED) {
     delay(500);
     //write_to_logs("...");
  }
  Serial.print("WiFi connected");
  Serial.print("\n");
  Serial.print(WiFi.localIP()); // Print the IP address
  Serial.print("\n");

  }

void loop() {
  }

Debug Messages:

Connecting to wifi with ssid/password: MYSSID/MYPASSWORD[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:385] _eventCallback(): STA IP: 192.168.1.39, MASK: 255.255.255.0, GW: 192.168.1.1
WiFi connected
192.168.1.39 
@stale
Copy link

stale bot commented Aug 1, 2019

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

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

stale bot commented Aug 15, 2019

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

@stale stale bot closed this as completed Aug 15, 2019
@szundi
Copy link

szundi commented Apr 13, 2020

Hello, this stale bot is silly. This is a problem for me too in 2020. Stale closed tickets don't fix themselves.

@lbernstone
Copy link
Contributor

By default, the esp32 runs in power save mode, where it lets the router queue up requests and only sends periodic beacon signals. To turn it off, you can do WiFi.setSleep(false);. I don't know if that will fix this, but it might.

@nopnop2002
Copy link

nopnop2002 commented Apr 24, 2020

This issues is very similar to the one below.

esp8266/Arduino#6886

It can occur on certain routers such as Mikrotik and Fritzbox.

It doesn't happen on my router.

@vito45h
Copy link

vito45h commented May 6, 2020

I have run in to a similar issue, for me my ESP32 is trying to send a UDP packet to a specific IP address.

I have a wireshark on my computer where i can see the ESP32 broadcasting an arp request and instantly the computer sends back a direct arp, as seen in the following screenshot
Screenshot 2020-05-06 13 29 34

At this point the ESP32 can't be ping from the computer, it seems the only way to get it working again is to power cycle it.

@jnwatts
Copy link

jnwatts commented Jun 20, 2020

I've been struggling with this for weeks: My ESP is acting as a server, and my clients would sometimes work just fine, and other times take up to a minute (usually timing out) to get a response from the ESP. The issue is not a failure to respond to ARP, it's that the wifi-modem is in low power by default!!

The only reason my clients ever managed to work, was due to the default gratuitous arp frequency of 60 seconds: Client would issue ARP request, and IF a G-ARP happens within the connect-timeout period, then the connection would succeed and all is well.

Unfortunately, I'm not sure how/where to set this for arduino-esp32, as I switched over to esp-idf. In the idf API, the solution is to turn of wifi-modem sleep:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/sleep_modes.html

ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE));

@lbernstone
Copy link
Contributor

WiFi.setSleep(false);

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

6 participants