EthernetENC icon indicating copy to clipboard operation
EthernetENC copied to clipboard

not pingable after a while

Open honk79 opened this issue 3 years ago • 14 comments

Hi, I use the library with the Nano Ethernet Shield on an ESP32 Dev Kit-C. I also use the PubSubClient-Library to send MQTT messages. After some time (varies between some seconds and half an hour) the shield won't answer on pings. The "LinkStatus" is still 1. For me it looks like some buffer or memory problems. When I have less traffic, the problem takes longer to occure.

Thanks for the help!

honk79 avatar Jun 27 '22 08:06 honk79

try to add Ethernet.maintain(); into loop()

JAndrassy avatar Jun 27 '22 09:06 JAndrassy

I tried it and placed it as the firts command in the loop(), but still the same problem.

honk79 avatar Jun 27 '22 09:06 honk79

does it execute at least every 200 milliseconds?

JAndrassy avatar Jun 27 '22 11:06 JAndrassy

yes, actually it is a very short loop.

void loop() {
  Ethernet.maintain();
  if (!client.connected()) {
    mqttReconnect();
  }
  if (millis() - timeSensorLastUpdate >= timeSensorInterval) {
    timeSensorLastUpdate += timeSensorInterval;
    pir.readStatus();
    Serial.print("HardwareStatus: ");
    Serial.println(Ethernet.hardwareStatus());
    Serial.print("LinkStatus: ");
    Serial.println(Ethernet.linkStatus());
  }
  if (millis() - timeMQTTLastUpdate >= timeMQTTInterval) {
    timeMQTTLastUpdate += timeMQTTInterval;
    mqttSendAll();
  }
  client.loop();
}

honk79 avatar Jun 28 '22 05:06 honk79

and the sketch still runs when the enc28j60 doesn't respond to ping?

JAndrassy avatar Jun 28 '22 07:06 JAndrassy

yes, the rest is running. when the mqtt-client tries to connect everything has to wait round about 5 seconds, and the sensor is reading. the link-status is still "1".

honk79 avatar Jun 28 '22 08:06 honk79

I think I have the same issue. After a few days, my Uno with ENC28J60 becomes unresponsive but the sketch still runs.

Arduino UNO R3 with some generic ENC28J60 board. Sketch runs the following (all lastest versions): EthernetENC PubSubClient DSCKeybusInterface

Unfortunately, with all this code packed in, I cannot crank up the serial prints of EthernetENC to a useful level of verbosity.

bennydiamond avatar Sep 07 '22 17:09 bennydiamond

could you try to reset the router? it may help

JAndrassy avatar Sep 07 '22 18:09 JAndrassy

It does not. Only resetting the Arduino resolves the issue, temporarily.

bennydiamond avatar Sep 08 '22 13:09 bennydiamond

Same problem here. Using EthernetServer on Controllino Mini (identical to Arduino UNO) and the server is not reachable after a certain amount of runtime (after few hours). The rest of the program is running. Only resetting the arduino helps.

mikeycoding avatar Jul 04 '23 13:07 mikeycoding

I am also facing the same issue, with Arduino 2560 and ENC28j60, Connection goes deaf after a few hours of being active, Arduino works as a client to connect to a remote website and exchange messages every five seconds, so after a few hours of being active it loses connection and is not visible in the list of connected clients in router. I haven't tried building the custom delay function, which I will do shortly and test. I appreciate any help I can get as I am trying to use ENC28j60 in production and I have rest of the parts of this project working, idk if it is a good idea to use it in production, but if not this, I would like to know if there is anything else I should be using, thanks for any help in advance.

alisyd avatar Jan 22 '24 06:01 alisyd

@alisyd do you use the 2.0.4 version?

JAndrassy avatar Jan 22 '24 08:01 JAndrassy