7
\$\begingroup\$

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$.

\$\endgroup\$
  • \$\begingroup\$ Have you run out of memory? Used up some other resource? \$\endgroup\$ – pjc50 Feb 26 '13 at 11:23
  • \$\begingroup\$ You really need to post a bit of code for a question like this. It might be something as simple as you are not handling disconnections / timeouts from the server correctly which might account for why it appears somewhat random. \$\endgroup\$ – PeterJ Feb 26 '13 at 11:36
  • \$\begingroup\$ Updated my post. (Testing this actually on a EtherMega 2560 from freetronics and a Mega 2560 with WiFi Shield) they are running now since 30 minutes, I let you now if both or one of them hangs. \$\endgroup\$ – tbraun89 Feb 26 '13 at 12:59
  • \$\begingroup\$ So what is the output of the Serial Monitor when it "hangs" \$\endgroup\$ – vicatcu Feb 26 '13 at 14:54
  • \$\begingroup\$ It permanently prints the content of a website, when it hangs it is somewhere in the HTML file. (Added my testing results with with the too other Arduinos as Update) \$\endgroup\$ – tbraun89 Feb 28 '13 at 10:52
0
\$\begingroup\$

UPDATE

Here is a working solution testet with Mega (1.0.1) and Due (1.5.3)

Ok, it seams there is a bug in the arduino 1.0.x libraries that causes the ethernet module to hang after some time, when you have to permanetly query a server.

With the Arduino Due (arduino 1.5.2) it is now running and also much faster! So its maby the best option to use this when you have to deal with much network traffic and many operations. I will contact the arduino developers about this issue and update this answer when I got more information about this problems.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.