EthernetShield not assigning IP

I tried many options and worked out the examples in Ethernet ibrary to setup the MAC and IP for Ethernet Shield.But nothing seems to be working.

I executed below program which I got from one of the topic posted in this forum.
#include <SPI.h>
#include <Ethernet.h>

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

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

// disable SD SPI
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);

// Start ethernet
Serial.println(F("Starting ethernet..."));
Ethernet.begin(mac, ip);
Serial.println(Ethernet.localIP());

delay(2000);
Serial.println(F("Ready"));
}

void loop() {
}

Serial monitor output was :

Starting ethernet...
0.0.0.0
Ready

Then,I tried,
#include <SPI.h>
#include <Ethernet.h>

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

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

// disable SD SPI
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);

// Start ethernet
Serial.print(F("Starting ethernet..."));
Ethernet.begin(mac, ip);
Serial.println(Ethernet.localIP());
}

void loop() {
}

Serial monitor output was:
Starting ethernet...0.0.0.0

I also tried the code in
http://forum.arduino.cc/index.php?topic=288175.5;wap2
But in Serial monitor ,I could not see anything .

Is there really some problem with W5100 or SP bus? I am not sure whether I have to really replace the Ethernet Shield.

I can see that Arduino is connected properly with Ethernet Shield and some leds are glowing.For reference,I attached two images which shows my Arduino and Ethernet Shield connections in this post.

It appears your ethernet shield is not seated correctly onto your Arduino. Insure the pins are aligned correctly, especially the ICSP pins, and the pins insert fully into the sockets. The socket on the bottom of the shield should fit onto the ICSP pins on the Arduino.

Do you connect it to a router? Make sure that your IP address range is correct - some routers have IPs like :
192.168.0.xxx

@waski: The first code the OP ran shows the Arduino is not communicating with the w5100. Once the first sketch works, we'll work on the router part.

Hi,
I verified whether the ICSP pins are inserted properly.And,yes i pressed the pins well and could see that the pins are inserted properly.Still no luck :frowning:

Then it sounds like you have a defective shield. Insure you are using an ethernet shield with a w5100 IC. There are also w5200 and ENC28J60 shields available.

If it is a w5100, check the w5100 IC for solder bridges. That has been a problem with some manufacturers of these shields. Some pins are ok if solder bridges present, but some pins will cause a fail if solder bridges are present. Here is a pic with a few examples:
http://s681.photobucket.com/user/grue2/media/Computers/pict10842.jpg.html

Thanks a lot... :slight_smile: I replaced the EthernetShield as I checked with the vendor.They confirmed that the IC has gone due to short circuit.
I previously connected only USB cable with Arduino+Ethernet Shield.I didn't connect external powersupply.Vendor adviced me to use both..

I am using new Ethernet Shield which the vendor told working component.I connected both the power supply and USB.
Pics of Power supply adapter and Connections for your reference attached..

Below is the code used,
#include <SPI.h>
#include <Ethernet.h>
#define PORT 80

byte mac[] = {0x5e, 0xa4, 0x18, 0xf0, 0x8a, 0xf6};
IPAddress arduinoIP(192, 168, 1, 67);
IPAddress dnsIP(203, 145, 184, 32);
IPAddress gatewayIP(192, 168, 1, 1);
IPAddress subnetIP(255, 255, 255, 0);

EthernetServer server(PORT);

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

// disable SD SPI
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);

// Start ethernet
Serial.print(F("Starting ethernet..."));
Ethernet.begin(mac, arduinoIP, dnsIP, gatewayIP, subnetIP);
Serial.println(Ethernet.localIP());
}

void loop() {
}

=======================
Still serial monitor is,
Starting ethernet...0.0.0.0

Telnet is,
C:\Users\Radhamani>telnet 192.168.1.67
Connecting To 192.168.1.67...Could not open connection to the host, on port 23:
Connect failed

Ping is,
C:\Users\Radhamani>ping 192.168.1.67

Pinging 192.168.1.67 with 32 bytes of data:
Request timed out.
Reply from 192.168.1.3: Destination host unreachable.
Reply from 192.168.1.3: Destination host unreachable.
Reply from 192.168.1.3: Destination host unreachable.

Ping statistics for 192.168.1.67:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),

Browser also no result :(

Any help on this please?

Client test code you can try unmodified to see if you get a response from the server.

//zoomkat 3-1-13
//simple client checkip test
//for use with IDE 1.0.1 or later
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "checkip.dyndns.com"; // test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600); 
  Serial.println("Better client ip test 3/1/13"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
} 

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET / HTTP/1.0"); //download text
    client.println("Host: checkip.dyndns.com");
    client.println(); //end of get request
  } 
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

This is a problem. It shows the Arduino is not communicating with the w5100 on the SPI bus.

Starting ethernet...0.0.0.0

Until you get this to report the ip in your global variables, nobody's ethernet code will work.

Do you have anything else connected to your Arduino? What model Arduino do you have?

As I have attached the pictures in my previous post,I dont have any other components connected to Arduino UNO except for Ethernet Shield.I have connected RJ45 cable,External powersupply,and USB cable.

Does connecting External power supply mandatory for Ethernet shield+Arduino UNO?
Vendor technical person,its Ethernet shield IC got short-circuited because of not providing external power supply along with USB cable connected to PC.

These are the lights (picture attached) glowing in my Ethernet shield.Kindly let me know whether these lights do not indicate that there is a problem with W5100 and SPI

USB power is all that should be required.

Your pictures don't show one, but if you have an SD card in the SD slot, remove the SD card.

I dont have SDcard in that..

Hi all,
Once I replaced the Ethernet shield,its working fine for me :slight_smile: Thanks all for your help..