I am using an arduino to retrieve some data from a web application. The problem is that after some time it starts to hang.
For testing I used the default EthernetClient
sketch and modified it a bit that every few secounds there is send a request to the server to get the information. For testing I don't do anything with the data I get so it does only send the request and retrieve the data.
For testing I use a Arduino Mega 2560 + Ethernet Shield and a Arduino Ethernet board, I experience the problem on both. It runs from 30 minutes up to one day then the whole board freezes. The boards doesn't get hot or anything else.
At first it seams to work but after some undefined time it starts to hang, does anyone have an idea what could cause this? Is there a bug on the arduino or the W5100 Ethernet chip?
Would you try to fix this issue or switch to a Raspberry Pi? Using the watchdog timer is no option because it doen't work on the Mega without changing the bootloader.
UPDATE (Added my loop code, there are no memory issues, I testet that before):
void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
delay(2000);
if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET / HTTP/1.0");
client.println();
}
}
}
This is all it does, in the setup there is the default initialization code from the Ethernet demo sketch.
UPDATE 2
Testing with Arduino Mega + WiFi Shield hangs too.
Testing with EtherMega 2560 from freetronics is now running 2 days without any problems I will continue this for min. one week. My only problem with this bord is the price. It's around 100$.