Uno + ETHShield can't connect

Hi boys and girls,

I have tried to do my best but finally I can't get Arduino UNO with official ETHShield (Wiznet5100 with SD micro) to be connected to network. I tried the samples coming with IDE 0022 and "Ethernet" library but I can't see/ping shield on my network. I'm successful in some respect only using the Polling sketch under library EthernetDCHP - running it I can see Arduino in my client list on router with IP assigned by DCHP and ping that IP from Windows command line.

When I compile the examples working with Ethernet library with fixed IP address (and / or gateway and subnet values) I have shield with blinking RX/link LEDs only and .... nothing more.

I also tried different cables and another router, unfortunately without success. My simple sketch for test:

#include <Ethernet.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x2E, 0x78 };
byte ip[] = { 192, 168, 2, 6 };
byte server[] = { 64, 233, 187, 99 }; // Google

Client client(server, 80);

void setup() {
Ethernet.begin( mac, ip );
Serial.begin(9600);

delay(1000);

Serial.println("connecting...");

if (client.connect()) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}

void loop() {
}

The Serial.print gives "connecting ..." and "Connection failed" only so it seems that either "Ethernet.begin" or "client.connect()" don't work as expected.

For sake of good order the MAC is from sticker on the shield's back side, network parametres should be OK as it works for another network components.

Does anybody have idea what can be wrong ??

Cheers
Vladimir

Below is some simple client test code you can try. Note that the ip address 192.168.1.* probably needs to match that part of your router lan ip address.

//zoomkat 11-13-10
//simple ethernet client test code
//for use with IDE 0021 and W5100 ethernet shield
//modify the arduino lan ip address as needed
//open serial monitor to see what the arduino receives
//push the shield reset button to run client again

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 102 }; // Arduino IP address
byte server[] = { 208, 104, 2, 86 }; // zoomkat's web site

Client client(server, 80);

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
  Serial.println("starting simple arduino client test");
  Serial.println();

  delay(1000);

  Serial.println("connecting...");

  if (client.connect()) {
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0");
    client.println();
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    Serial.println("==================================");
    Serial.println("");
    client.stop();
    for(;;);
  }
}

Thanks a lot for your respond,

I tried the test sketch changing only MAC and IP address to comply with my shield and local LAN settings but unfortunately I have got on Serial.print the same as before:

starting simple arduino client test

connecting...
connection failed

disconnecting.

Is there any other idea what to test ??

May be you need to define also gateway and subnet.

The begin method is overloaded:

[..]
Ethernet.begin(mac, ip, gateway, subnet);

instead of

Ethernet.begin(mac, ip);

[..]

ipconfig -all may help you find the right addresses.

Bye

Log into your router and see if it recognizes the ethernet shield as being attached with the ip address you used. The below part of the arduino ip address needs to match that part of your router ip address.

byte ip[] = { 192, 168, 1, x }; // Arduino IP address