Ethernet Sheild: Unable to Connect

Hello,

I hope that someone can help me with issues I am having with the ethernet shield -- I cannot connect. I am trying a simple example from Simon Monk's "Getting Started with Sketches" updated example and others on line. Below are the details including test results and the code. I would appreciate any suggestions.

Issue and Environment

  • Arduino Uno R2

  • Arduino Ethernet Shield -- no v# -- it has the SD reader. MAC sticker -- address entered into code

  • Powered USB hub and a wall wart at 12V/1AMP -- no supply issues

  • Network: Wireless Router physically connected through one switch back to the router. Both my Mac and the Arduino are connected to the same switch

  • Arduino 1.0
    Troubleshooting History
    I have tried several other troubleshooting processes, more significantly the following:

  • http://bildr.org/2011/06/arduino-ethernet-pin-control/ -- using just the mac address (no set IP)

  • Arduino Forum -- from which I learned a lot about how this all works

  • Other examples

  • Bypassed network switch and connected directly shield directly to router

Board Status

  • The Link and RX LEDs light periodically
  • The 100M light is on
  • Hit the reset upon loading code to Arduino

System Feedback

Ping
Aiko2:~ motisonic$ ping 192.168.1.30
PING 192.168.1.30 (192.168.1.30): 56 data bytes
Request timeout for icmp_seq 0

Arp
--- 192.168.1.30 ping statistics ---
4 packets transmitted, 0 packets received, 100.0% packet loss
Aiko2:~ motisonic$ arp -a
? (192.168.1.1) at 58:6d:8f:7:73:45 on en0 ifscope [ethernet]
? (192.168.1.30) at (incomplete) on en0 ifscope [ethernet] <-----*********************** check it out, there it is but claims the MAC address is incomplete. This appears inconsitently
etc,

Routing Table

Internet:
Destination Gateway Flags Refs Use Netif Expire
192.168.1.30 link#7 UHLWI 1 72 en0

In code
Serial.println(Ethernet.localIP()); results in 0.0.15.31 -- what does this indicate?

Code with comments

// sketch 10-01 Simple Server Example

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x9A, 0xBD }; // As printed on the sticker on the PCB: 90-A2-DA-00-9A-BD
//byte ip[] = { 192, 168, 1, 30 }; //IP address is an open address and within range
//byte dns[] = { 75, 75, 75, 75 }; //Also tried 75.75.76.76 and 192.168.1.1 from router settings
//byte gateway[] = { 192, 168, 1, 1 }; // confrimed gateway
//byte subnet[] = { 255, 255, 255, 0 }; //confirmed rounter

EthernetServer server(80);

void setup()
{
//Ethernet.begin(mac, ip, dns, gateway, subnet); // Verbose Config
//Ethernet.begin(mac, ip); // Original Config
Ethernet.begin(mac); // Simple Config
server.begin();
Serial.begin(9600);
}

void loop()
{ etc….

Also tried the following
delay (10000); // give it time to start up
Serial.println(Ethernet.localIP()); Returns 00.00.00.00

If your local IP address shows up as 00.00.00.00 it probably means that you are not finding a DHCP server on your local network. Which device is supposed to be providing DHCP services? Is there a router? Is the Mac configured for network sharing?

//byte ip[] = { 192, 168, 1, 30 };      //IP address is an open address and within range

Does your router know that the Arduino is using that address? If not, any attempt to ping that address is going to fail, since the router knows it hasn't issued that address.

Some test code you can try.

//zoomkat 2-13-12
//DNS and DHCP-based web client test code
//for use with IDE 1.0
//open serial monitor and send an e to test
//and to see test result
//for use with W5100 based ethernet shields
//browser equivelant URL: 
//http://web.comporium.net/~shb/arduino.txt
//note that the below bug fix may be required
// http://code.google.com/p/arduino/issues/detail?id=605 

#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

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

void setup(){
  Serial.begin(9600); 
  Serial.println("DNS and DHCP-based web client test 2/13/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // print your local IP address:
  Serial.print("Arduino IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print("."); 
  }
  Serial.println();
  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 /~shb/arduino.txt HTTP/1.0"); //download text
    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

}

Thanks for the responses. To John and Paul's questions:

Which device is supposed to be providing DHCP services? Is there a router? Is the Mac configured for network sharing?

I am using a LinkSys E3200 Router -- new, problematic in that it does not accurately update the lease table for wired and wireless connections. So I use OSX Network Utility to see what is up. In this case I am using the code that Zoomkat provided. I did reserved the IP and the MAC address in the DHCP table of the router.

I looked at the router table and 192.168.1.30 appeared with:

Internet:

Destination Gateway Flags Refs Use Netif Expire

192.168.1.30 link#7 UHLWI 1 72 en0

Then I removed the reservation in the DHCP reservation and the entry and the entry disappeared.

Here are the results of Zoomkat's test -- which I actually tried yesterday as well based on a posting:

  1. I used this code for all the above tests
  2. I tried reserving and not reserving the IP in the DHCP table
  3. I hard coded the MAC address as it appears on the shield sticker: 90:A2:DA:00:9A:BD
  4. When I had no luck, I tried to define the array for the MAC [6] -- something I saw somewhere: byte mac[6] = { 0x90, 0xA2, 0xDA, 0x00, 0x9A, 0xBD }; //physical mac address -- pdw: 2nd time, defined the array
  5. I added the IP address with the array defined IP: byte ip[4] = { 192, 168, 1, 30 }; //IP address is an open address and within range
  6. Tried combos of all above
  7. Sometimes noticed a lot of RX and the undefined LED toggle on the board at times.

Only once got a response from the serial test that it failed to connect. All other times it just hung. I never got the "Woohoo! Your arduino ethernet client works! zoomkat" message.

Finally, I followed the links to update the W5100.h file -- I cannot find it on my Mac. Where would I look to update this header file?

Is it possible the device is defective?

Thanks for all your help.

Paul

I decided to order a second Ethernet Shield to rule out the hardware. I received it today, loaded up Zoomkat's code and got a response back immediately. The problem was a bad shield. Thanks all for your help.

Cheers!

Paul

For future reference, what type of ethernet shield was the bad one and what shield now works?

I have already packed up the bad one for a return to vendor but here are the details: Both are Wiznet W51 chip but the component configuration was different.

  • The defective one has the Arduino logo.
  • The working one has no logo and running paralell to the outs in a row from the crystal has LEDs TX, RX, COLL, 100M, LINK and PWR

Let me know if there is any more info that you need to distinguish the two boards.

Thanks,

Paul