No response from Ethernet Shield with Arduino UNO

Hello,

I have a problem connecting my Arduino UNO + Ethernet Shield to Internet. I connect the Arduino to my laptop USB and a 8V power supply. I use an Ehternet cable to connect the shield to the router, with the following IP addresses:

IP address of router: 192.168.1.1 (checked)
IP address of Arduino Ethernet : 192.168.1.117 (I have tryed different addresses in my IP range)

No other cables or electronics is connected to the Arduino. I have tryed with three different Ethernet cables, two different computers and two routers, with two differen ISP (Orange and Movistar, in Spain).

All the codes I have tryed stop when “Ethernet.begin(mac)” is called. This is one of the codes I’m using:

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

byte mac[] = {
  0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC }; // <---- I use random HEX numbers

bool checkdhcp()
{
  Serial.println(F("Waiting for DHCP lease ..."));    // This is the only message that I get from the Serial Monitor
  if (Ethernet.begin(mac) == 0){
    Serial.println(F("Failed to configure IPv4 for using Dynamic Host Configuration Protocol!"));
    return false;
  }
  else {
    Serial.println(F("Dynamic Host Configuration Protocol passed")); // I don't get this print
    Serial.print(F("Board IP address = "));
    Serial.println(Ethernet.localIP());
    Serial.print(F("Network subnet mask = "));
    Serial.println(Ethernet.subnetMask());
    Serial.print(F("Network gateway IP address = "));
    Serial.println(Ethernet.gatewayIP());
    Serial.print(F("DNS IP address = "));
    Serial.println(Ethernet.dnsServerIP());
    Serial.print(F("MAC = "));
    for (byte thisByte = 0; thisByte < 6; thisByte++) {
      if (mac[thisByte] < 16){
        Serial.print(F("0"));
      };
      Serial.print(mac[thisByte], HEX);
      if (thisByte < 5) {
        Serial.print(F(":"));
      };
    };
    Serial.println();
    return true;
  };

};
void setup()
{
   Serial.begin(9600);
   if (!checkdhcp()){
    /* nothing to do */
  };
};

void loop()
{
  // some code here
};

I would thank very much any help.

Regards, Javier.

The Ethernet.begin(mac) function call will take about 2 minutes to return a fail. Are you waiting that long?

If you have a SD card in the shield's slot and have not disabled the SD SPI, that will cause a permanent fail and the begin call will never return.

Thanks for your reply.

I have been wating for more than 5 minutes several times.

No SD card is inserted in the shields slot.

I´ll keep trying. Thans anyway for your help.

Javier.

Are you certain it is a w5100 IC on that ethernet shield. Look closely. The w5200 and w5500 will not work with the standard ethernet library.

It is aw5100 IC. I have just checked it with a stamp magnifier (just in case).

Thanks, Javier.

Try this test code. If the serial monitor shows 192.168.0.2, then the SPI bus and the SPI side of the w5100 is working. If it shows anything else, then the SPI communication is failing. If it fails, there is no sense going any farther until it works.

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

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

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

  // disable SD card if one in the slot
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Serial.println("Starting w5100");
  Ethernet.begin(mac,ip);

  Serial.println(Ethernet.localIP());
}

void loop() {
}

If it is failing, check the pin connection from the Arduino to the shield, especially the ICSP pins. That is how the SPI data lines connect.

Also check the w5100 for possible solder bridges (solder connecting adjacent pins).

Thanks very much SurferTim for your help.

I think I am close to the problem now. I have tryed with a different Arduino UNO board and it works! It seems that the other board has something wrong. I have been using it for several projects and never got any problem before. I''ll check first all the pins with simple LED blinking or LED fading. At least now I know I am not doing silly things :) .

Javier.

Check the ICSP pins on the Uno that is failing. Maybe you have a solder bridge or a cold solder joint on it.