My Ethernet shield 2 on a Arduino uno r3 ran for about a week and then would not answer web requests.
I removed power to it and then restored power and it resumed it's normal function.
How might I stop this from happening in the future?
My Ethernet shield 2 on a Arduino uno r3 ran for about a week and then would not answer web requests.
I removed power to it and then restored power and it resumed it's normal function.
How might I stop this from happening in the future?
My guess - a variable eventually overflows, or the board runs out of memory, or an array goes out of bounds.
Does it always go the same time before malfunctioning?
Show us the sketch.
thanks for your reply.
For now, I am thinking to have the unit do a hard reset periodically perhaps once a day.
Please suggest how to do this.
Is your shield exposed to the internet? Maybe you are running out of sockets? Add this to your sketch and call it when you think necessary. I would start out calling it after every request. This was written for the w5100, and I do not have a w5500 to test the code with. If you are running out of sockets due to port scanners, resetting may not be practical.
#include <utility/w5500.h>
byte socketStat[MAX_SOCK_NUM];
void ShowSockStatus()
{
for (int i = 0; i < MAX_SOCK_NUM; i++) {
Serial.print(F("Socket#"));
Serial.print(i);
uint8_t s = W5500.readSnSR(i);
socketStat[i] = s;
Serial.print(F(":0x"));
Serial.print(s,16);
Serial.print(F(" "));
Serial.print(W5500.readSnPORT(i));
Serial.print(F(" D:"));
uint8_t dip[4];
W5500.readSnDIPR(i, dip);
for (int j=0; j<4; j++) {
Serial.print(dip[j],10);
if (j<3) Serial.print(".");
}
Serial.print(F("("));
Serial.print(W5500.readSnDPORT(i));
Serial.println(F(")"));
}
}
edit: A status list:
0x0 = available
0x14 = waiting for a connection
0x17 = connected
0x1C = connected waiting for close
0x22 = UDP