[Solved] Failed ethernet W5100 shield (reset not working)

I have a problem with my Ethernet W5100 shield “mega compatible” (last version, with sd card)
It’s only work, if I power the Ethernet shield a few second after power on the Mega, but before the ethernet.begin()

I try the ethernet shield on both uno card and mega 2580 card, and I have the same problem, the ethernet start, send packets, but seems to never read any packet.
If I use DHCP mode, I see (network trace) the DHCP request, and the dhcp answer from the router, but the ethernet shield continue to ask dhcp.
If I use static IP, I just see the ARP request (and the ARP answer) but the ethernet shield continue to ask ARP.
If I ping the card, the card never answer to the ARP request.
(All my code was also test with a Arduino Ethernet “all-in-one” and work perfectly on that card)

Because I think about a bad connection, I try to plug the card manually

mega <-> Eth shild
4 4
10 10
SPI 50, 51, and 52 on the Mega
5V 5V
I have exactly the same issue with that plug

BUT, If I had a 10s delay on the code, at the very beginning, (before ethernet.begin()) and If I plug the 5V on the ethernet shield 5 seconds after power on the mega card, all work perfectly well. (ethenet & sdcard)
I don’t have the same result If I use the reset button on the ethernet shield, or send a reset by the reset PIN before ethernet.begin.

Does some one have the same issue ? Do you know any solution to do a hard reset on the ethernet shield without a manual plug/unplug ? (I can use a relay for that… but I think it’s a very dirty solution…)

Do you think my card was buggy ? (The reset don’t work)

Sorry for my bad English, I hope you understand anyway.

Try upgrading to IDE v1.0.1. If you are using v1.0, the ethernet library has a bug that will cause dhcp to fail (not return from the Ethernet.begin call). http://arduino.cc/forum/index.php/topic,72232.msg727530.html#msg727530

edit: Also try disabling the SD SPI. That will cause problems with the w5100 SPI communication. I use this before the Ethernet.begin() call in the setup.

pinMode(4,OUTPUT);
digitalWrite(4,HIGH);

Thanks for your help. Some more info. I was in 1.0, on Windows 7/32. i am new in ardurino, never try previous version

I Allready try to disable Sd. pinMode(4, OUTPUT); digitalWrite(4, HIGH); and to enable 53 (I found this on a forum, but don't work) pinMode(53, OUTPUT); digitalWrite(53, HIGH); I also try your dhcp hack, it's not work. And the problem was also present in static IP.

I don't know If I had to enable 10 before send a reset to the card, I will try tonight to

#define DO_RESET_ETH_SHIELD 40  // Mega 40 connected to reset pin on ethernet shield 

pinMode(10, OUTPUT);
digitalWrite(10, LOW);                          // did not test/add this line for the moment
 pinMode(DO_RESET_ETH_SHIELD, OUTPUT);      // sets the digital pin as output
 digitalWrite(DO_RESET_ETH_SHIELD, LOW);
 delay(1000);  //for ethernet chip to reset
 digitalWrite(DO_RESET_ETH_SHIELD, HIGH);
 delay(1000);  //for ethernet chip to reset
 pinMode(DO_RESET_ETH_SHIELD, INPUT);      // sets the digital pin input
 delay(1000);  //for ethernet chip to reset
 Ethernet.begin(mac,ip);
 delay(2000);  //for ethernet chip to reset

I just found the 1.0.1-RC1, I will also try tonight. (I cannot now, I am at work !) I also just found one of your discussion with hardcore about adding some delay in the W5100Class::init, I will also try tonight. http://arduino.cc/forum/index.php/topic,85342.msg679835.html#msg679835

Does the program not return from the Ethernet.begin(mac,ip) call? Or just fail and continue executing the code?

Before the "605 bug" patch (in v1.0.1), mine did ok with the Ethernet.begin(mac,ip) call. It would lock up in code like this:

while(client.available())
{
   client.read();
}

The client.available() call would return bogus values (never zero) and never exit the loop.

SurferTim: Does the program not return from the Ethernet.begin(mac,ip) call? Or just fail and continue executing the code?

It's append some time (rarely) that the program stop at this point. On this case, the connected led on the ethernet port don't light UP. But in most case, It go further, the connected light go UP, and the shield send packet (just the ARP request)

I will also try your loop, because the shield seem to not receive any packet.

When it fails, see if you can ping the ethernet shield ip from a computer. If you can ping it, then the setup stuff is ok, and it is having trouble receiving packets.

Use something like this to determine where it is failing.

void setup()
{
   Serial.begin(9600);

   pinMode(4,OUTPUT);
   digitalWrite(4,HIGH);

   Serial.println("Setting ethernet");
   Ethernet.begin(mac,ip);
   Serial.println("Ethernet ok");

   // rest of your setup
}

SurferTim: When it fails, see if you can ping the ethernet shield ip from a computer. If you can ping it, then the setup stuff is ok, and it is having trouble receiving packets.

I don't think so, when it's fail, the port even don't go up (Led 100M and FULLD don't light UP). most of the time it's not fail at this point.

Same result, don’t work, I try with
Arduino 1.0.1-RC1 / default eth library
Arduino 1.0.1-RC1 / eth lib + hardcore delay patch in w5100::init
And in fix IP and dhcp mode

My code was

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 4);
IPAddress gateway(192,168,1, 254);
IPAddress subnet(255, 255, 255, 0);
IPAddress dns2(192,168,1, 254);

EthernetServer server(80);

void setup()
{
  Serial.begin(115200);
  Serial.println("Begin Setup");
  pinMode(4, OUTPUT); 
  pinMode(10, OUTPUT); 
 // pinMode(53, OUTPUT); 
 // digitalWrite(53, LOW); 
  digitalWrite(4, HIGH);
  digitalWrite(10, LOW);
  Serial.println("eth begin");
  Ethernet.begin(mac, ip);
  //Ethernet.begin(mac, ip, dns2,gateway,subnet); //With default route
  //Ethernet.begin(mac); //DHCP Test
  Serial.println("server begin");
  delay(500);
  server.begin();
  Serial.println("end server");
  EthernetClient client = server.available();
  while(client.available())
  {
    Serial.println(client.read());

  }
  Serial.println("end Setup");
}

void loop()
{
}

It’s never ping with Mega2560/ethernet shield, (even if all led go UP PWR/Link/100m/FULLD and RX/TX blinding)
The “end Setup” was printed on the serial.
and the exactly the same code work perfectly with my arduino ethenet

If no ping, there is a problem. Maybe a bad shield. I guess that happens now and then.

This exact code works in an Arduino Ethernet? Same ethernet setup? Can you ping it?

Exactly the SAME code (I just change Tools->Board->arduino ethernet) and the same ethernet cable, on the same switch port

edit To have the same arvdude, also try Ardurino UNO + Ethernet shield, and the same result as with mega2580, don't ping

After look at the layout and doing some test, I think the W5100 reset was not plug correctly.

Can someone do a test for me ?

Can you run this code, and do a continuous ping the arduino. (ping -t 192.168.1.4)
When it’s ping, just press the shield reset button.
Did the host continue to ping, or do you have to wait 15 seconds for pinging start again ?
In my case, If I press the reset button (or open again serial monitor), it’s continue to ping…

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 4);



void setup()
{
  Serial.begin(115200);
  Serial.println("Start");
  delay(15000);
  Serial.println("Stop Begin delay");
  pinMode(4, OUTPUT); 
  pinMode(10, OUTPUT); 
  digitalWrite(4, HIGH);
  digitalWrite(10, LOW);
  Ethernet.begin(mac, ip);
  Serial.println("end server");
}

void loop()
{
}

It is about 16 seconds after reset it starts answering a ping, about a second after the "end server" message on the serial monitor.

edit: The ping fails as soon as I press the reset button.

SurferTim: edit: The ping fails as soon as I press the reset button.

Thanks a lot for your help. It's confirm that in my shield, the reset button was not connected to the W5100 ship. It's explain why my initialization was randomly buggy, because a reset is need after each power. (see the wiznet below) Normaly, A capacity was installed on the reset line for that, it's the 100n C3 in http://arduino.cc/en/uploads/Main/arduino-ethernet-shield-06-schematic.pdf

read from wiznet http://www.wiznet.co.kr/include_Files/Just_Download.asp?PK_NUM=101&file_local_path=ReferenceFiles&file_local_name=W5100_AN_SPI.pdf Because the W5100 does not support Power-on-Reset, this pin (reset) should assert low for at least 2us when power is applied to the W5100.

The bad new was my card was faulty, the good new was I learn so many think in debuging my problem :-)

Old ethernet shield reset discussion.

http://marco.guardigli.it/2010/11/arduino-wiznet-ethernet-shield-proper.html

Last Update... I receive a new shield today from RMA, and it's work perfectly now... I am now 100% sure, My first shield was wrong. Thanks for every one for you help (especialy SurferTim)

@zoomkat The new shield design have a reset, don't need to do more than plug it... (if it's work !!)

Mmm it looks i arrive kinda late, but i had this problem and i solved it this way:

I take one of this (http://www.doctronics.co.uk/images/4016_01.gif) conected to pin 7
to low the resetpin when the arduino cant access to the SD card. Yes you need a SD card in order to try this “fix”.

Maybe is not the best way to handle this, but i dont have that 20nf and stuff other post said.

....

const int reset = 7;
int errores;


void setup()
{
  errores = 0;
  digitalWrite(reset, LOW);
  Ethernet.begin(mac, ip);  // initialize Ethernet device
  server.begin();           // start to listen for clients
  Serial.begin(9600);       // for diagnostics

  // disable Ethernet chip
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);

  // initialize SD card
  Serial.println("Initializing SD card...");
  if (!SD.begin(4))
  {
    Serial.println("ERROR - SD card initialization failed!");
    errores = 1;
    return;    // init failed
  }
  Serial.println("SUCCESS - SD card initialized.");

  if (!SD.exists("index.htm"))
  {
    Serial.println("ERROR - Can't find index.htm file!");
    errores = 1;
    return;  // can't find index file
  }
  Serial.println("SUCCESS - Found index.htm file.");
}

void loop()
{
  if (errores == 1)
  {
    Serial.println("Resetingggg.");
    delay (100);
    digitalWrite(reset, HIGH); // reseteo la placa por que no pudo inicializar la tarjeta (la placa de red) :)
  }........

Hope i help someone
(english is not my language)

Byez

W5100 reset solution