I have the same problem with Arduino DUE, ENC28J60 and the UIPEthernet V1.59 librairy.
It works fine 5 minutes and freeze.
Here's the entire test code :
#include <SPI.h>
#include <UIPEthernet.h>
// The connection_data struct needs to be defined in an external file.
#include <UIPServer.h>
#include <UIPClient.h>
EthernetServer server = EthernetServer(80);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
IPAddress myIP(10,6,18,200);
Serial.println("@ : 10.6.18.200 ...");
Ethernet.begin(mac,myIP);
server.begin();
}
void loop() {
EthernetClient client = server.available();
if (client) {
Serial.println(F("new client"));
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println(F("HTTP/1.1 200 OK"));
client.println(F("Content-Type: text/html"));
client.println(F("Connection: close")); // the connection will be closed after completion of the response
client.println(F("Refresh: 5")); // refresh the page automatically every 5 sec
client.println();
client.println(F("<!DOCTYPE HTML>"));
client.println(F("<html>"));
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print(F("analog input "));
client.print(analogChannel);
client.print(F(" is "));
client.print(sensorReading);
client.println(F("
"));
}
client.println(F("</html>"));
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println(F("client disconnected"));
}
}
I've change all the 'println' with 'println(F(' to try to save the SRAM but no result.