Ethernet shield not working

hi,
I have got a wiznet based ethernet shield, i plugged it in arduino uno, and it powered up, but it doesn't seem to be working though, i uploaded the webserver example but couldn't access the webpage from browser. I also uploaded the DhcpAddressPrinter example, in serial monitor it says cannot initiate internet connection by dhcp. Another thing is that my ethernet shield doesn't has a sticker at the bottom showing its MAC address. Is any MAC okay if there is no such address on the network? Please help me. The IP address i gave in the Webserver example is also in range of my local IP adresses, but still it is not accessible by the browser.

haiderabbasrizvi:
Is any MAC okay if there is no such address on the network?

Yes.
Have you tried replacing the ethernet cable between your shield and your router? Perhaps the cable is bad.

Try this test sketch. If the serial monitor shows 192.168.0.2, then the SPI side of the w5100 is working. If it shows anything else, like 0.0.0.0, then that part is failing.

#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() {
}

hi,
I tried all of the above but still I am not able to navigate the webserver from the browser, SPI part seems to be working fine because I uploaded the above code and it returned the correct ip in serial monitor, I changed the cable too, but it isn't working. I tried to ping it but it returned 'destination host unreachable'. Please help me

Try this. It tests the RJ45 side of the w5100. I presume the router has a dhcp server to issue network settings. Does it show “failed” after a couple minutes or an IP and gateway in a few seconds?

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

byte mac[] = {  0x00, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

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

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

  Serial.print(F("Starting ethernet..."));
  if(!Ethernet.begin(mac)) Serial.println(F("failed"));
  else {
      Serial.println(Ethernet.localIP());
      Serial.println(Ethernet.gatewayIP());
  }
}

void loop() {
}

it says 'failed' after sometime. What else can I do.

Is the ethernet shield connected to a router? Or is it connected to your PC ethernet port?

it is connected to a switch, although I tried to connect it directly to the router, but that also didn't work

You have a problem on the RJ45 side of the w5100.

Do the LEDs on the front of the RJ45 socket light up? One green and one orange?

Do you get a connection light on the switch or router?

Check the w5100 IC for solder bridges. Look for solder connecting adjacent pins. That is more common than you would expect.

the led's on the front of RJ45 socket light up, i get a connection light 'on' on the switch, i checked the w5100 IC, and I cannot see any solder bridges. Should I consider replacing the shield?

I think I would try it on another network first before I replaced it.

hi,
I still can't get my ethernet shield working, however i spotted a thing this morning, the on board pin 13 led sometimes blink but it is very very dim, can it indicate a problem. otherwise everything is fine, i get link lights on my switch/router, and lights on thge rj45 socket also turn on when connected to a network. Don't know what is the problem, please help me,

Pin 13 is the timing pin for the ethernet shield, so it normally dimly glows as it is blinking very fast. You might try the below client code unmodified to see if you get a response from the server.

//zoomkat 11-04-13
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test client GET
//for use with W5100 based ethernet shields
//remove SD card if inserted
//data from myIP server captured in readString 

#include <SPI.h>
#include <Ethernet.h>
String readString;

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

char serverName[] = "checkip.dyndns.com"; // myIP server 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("client readString test 11/04/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
  Serial.println();
}

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.1"); //download text
    client.println("Host: checkip.dyndns.com");
    client.println("Connection: close");  //close 1.1 persistent connection  
    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
    readString += c; //places captured byte in readString
  }

  //Serial.println();
  client.stop(); //stop client
  Serial.println("client disconnected.");
  Serial.println("Data from server captured in readString:");
  Serial.println();
  Serial.print(readString); //prints readString to serial monitor 
  Serial.println();  
  Serial.println();
  Serial.println("End of readString");
  Serial.println("==================");
  Serial.println();
  readString=""; //clear readString variable

}

I think i have same problem,
the SPI pins work, all LEDs on ethernet shield light up

haiderabbasrizvi@have you tried another network? does it work?

zoomkat@ i have tried your code, but it doesnt work, the serial monitor is blank

I think zoomkat has a small error in his code. Move the Serial.begin call to before the Ethernet.begin call.

void setup(){

  Serial.begin(9600);

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

Do you have a SD card in the shield's slot?

same result.. serial monitor doesn't show anything.

i don't have SDcard inserted..

Did you try the test sketch I posted in reply #2? Does it show anything on the serial monitor?

it worked before, serial monitor shows 192.168.0.2 . but after i try it again now it show 0.0.0.0

Hi, sorry to barge in your thread, I am facing Ethernet connectivity problem but from RJ45 side.

The serial monitor correctly displays the IP address and the gateway values, however, the LED lights (green and orange) on the RJ45 connectors dont turn on at all.

The ethernet shield has ENC28J60 chip and I am using UIPEthernet library, no problems there.

I am directly connected to the laptop ethernet port. I have changed 2 cables now, but I havent checked if they are cross over or direct cables ( I think post Windows 7, wire sequence (crossover or direct) wasnt a problem)...

In laptop: Local Area Connection on Network Connections says Network Cable Unplugged... so yeah, its really not picking any connection from RJ45 end...

Any pointers as to why the RJ45 LEDs not turning on even though the chip is correctly initialized via SPI and communicating with it?

Regards

Mak

SurferTim:
Check the w5100 IC for solder bridges. Look for solder connecting adjacent pins. That is more common than you would expect.

I checked mine and was very surprised to see this many bridged joints. See attached jpg.

Cheers
Dave.