arduino mega+ enc28j60

buonasera a tutti volevo chiedervi delle delucidazioni a riguardo una scheda arduino mega 2560 e un controller ethernet enc28j60
sto provando questo codice un po spulciato e modificato:

 #include <EtherCard.h>

static byte mymac[] = {
  0x00,0x1A,0x4B,0x38,0x0C,0x5C};
static byte myip[] = {
  192,168,0,220};
byte Ethernet::buffer[700];

boolean RELE1;
boolean RELE2;
boolean RELE4;


void setup () {

  Serial.begin(57600);

  if (!ether.begin(sizeof Ethernet::buffer, mymac, 10))
    Serial.println( "Failed to access Ethernet controller");
  else
    Serial.println("Ethernet controller initialized");

  if (!ether.staticSetup(myip))
    Serial.println("Failed to set IP address");
  ether.hisport=65000; 

  Serial.println();

  pinMode(2, OUTPUT);
  digitalWrite(2, LOW);
  pinMode(3, OUTPUT);
  digitalWrite(3, LOW);  
  pinMode(4, OUTPUT);
  digitalWrite(4, LOW);

  RELE1 = false;
  RELE2 = false;  
  RELE4 = false;
}

void loop() {

  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
  Serial.println("Received 1 command");
  if(pos) {

    if(strstr((char *)Ethernet::buffer + pos, "GET /RELE1ON") != 0) {
      Serial.println("Received ON command");
      RELE1 = true;
    }

    if(strstr((char *)Ethernet::buffer + pos, "GET /RELE1OFF") != 0) {
      Serial.println("Received OFF command");
      RELE1 = false;
    }


    if(strstr((char *)Ethernet::buffer + pos, "GET /RELE2ON") != 0) {
      Serial.println("Received ON command");
      RELE2 = true;
    }

    if(strstr((char *)Ethernet::buffer + pos, "GET /RELE2OFF") != 0) {
      Serial.println("Received OFF command");
      RELE2 = false;
    }

    if(strstr((char *)Ethernet::buffer + pos, "GET /RELE4ON") != 0) {
      Serial.println("Received ON command");
      RELE4 = true;
    }

    if(strstr((char *)Ethernet::buffer + pos, "GET /RELE4OFF") != 0) {
      Serial.println("Received OFF command");
      RELE4 = false;
    }
  }
  Serial.println("Received 2 command");
  if(RELE1) {
    digitalWrite(2, HIGH);
  } 
  else {
    digitalWrite(2, LOW);
  }
  if(RELE2) {
    digitalWrite(3, HIGH);
  } 
  else {
    digitalWrite(3, LOW);
  }
  if(RELE4) {
    digitalWrite(4, HIGH);
  } 
  else {
    digitalWrite(4, LOW);
  }

  Serial.println("Received 3 command");
BufferFiller bfill = ether.tcpOffset();
  bfill.emit_p(PSTR("HTTP/1.0 200 OK\r\n"
    "Content-Type: text/html\r\nPragma: no-cache\r\n\r\n"
    "<html><head><title>WebLeds</title>"
    "</head><body>"
    "<table  width=\"50%\" height=\"200\" cellpadding=\"1\"cellspacing=\"1\" bordercolor=\"#0000FF\" border=\"5\">"
    "<tr><td>Stato Rele Attuatori </td><td>Comandi</td></tr>"
    ));
  if(RELE1 == true)
    bfill.emit_p(PSTR("<tr><td style=\"color: red;\">RELE 1 ON</td><td>"));
  else
    bfill.emit_p(PSTR("<tr><td style=\"color: black;\">RELE 1 OFF</td><td>"));
  if(RELE1 == false)
    bfill.emit_p(PSTR("<input type=\"button\" value=\"clicca qui\"onclick=\"location.href='RELE1ON'\"></td></tr>"));
  else
    bfill.emit_p(PSTR("<input type=\"button\" value=\"clicca qui\"onclick=\"location.href='RELE1OFF'\"></td></tr>"));

  if(RELE2 == true)
    bfill.emit_p(PSTR("<tr><td style=\"color: red;\">RELE 2 ON</td><td>"));
  else
    bfill.emit_p(PSTR("<tr><td style=\"color: black;\">RELE 2 OFF</td><td>"));
  if(RELE2 == false)
    bfill.emit_p(PSTR("<input type=\"button\" value=\"clicca qui\"onclick=\"location.href='RELE2ON'\"></td></tr>"));
  else
    bfill.emit_p(PSTR("<input type=\"button\" value=\"clicca qui\"onclick=\"location.href='RELE2OFF'\"></td></tr>"));
  /*
   if(RELE4 == true)
   bfill.emit_p(PSTR("<tr><td style=\"color: red;\">RELE 4 ON</td><td>"));
   else
   bfill.emit_p(PSTR("<tr><td style=\"color: black;\">RELE 4 OFF</td><td>"));
   if(RELE4 == false)
   bfill.emit_p(PSTR("<tr><td><input type=\"button\" value=\"clicca qui\"onclick=\"location.href='RELE4ON'\"></td></tr>"));
   else
   bfill.emit_p(PSTR("<tr><td><input type=\"button\" value=\"clicca qui\"onclick=\"location.href='RELE4OFF'\"></td></tr>"));
  */
  bfill.emit_p(PSTR("</body></html>")); 

  ether.httpServerReply(bfill.position());
Serial.println("Received ");

il problema che mi assale e: appena aggiungo il blocco tra i commenti mi si impalla…nel senso che provando a stampare varie stringe per tentare di capire dove si blocca ma alla fine i passaggi li fa tutti solo che non mi carica la pagina web…
codice simile modificato per la ehternet shield R3 mi funzionava tranquillamente…siccome mi cementavo in questo hardware volevo capire se poteva essere un problema hardware o io impedito e mi incasino in qualche passaggio :slight_smile:
grazie per l’aiuto in anticipo
maurizio

probabilmente trovato il problema:

byte Ethernet::buffer[700];

portandolo a 2000 mi carica tranquillamente tutto... ora provo e vediamo se è stabile