Ethernet Shield cannot connect

Hi,

I am struggling with this Ethernet Shield.

To make it simle, I am trying the small examples for the Ethernet Library, currently the one that make a google search. I have changed it to use fixed ip (10.0.0.9) instead of DHCP.

However, it just says "connection failed" on the serial monitor. What is weird though is that I have actually got a http response twice out of about 100 attempts. I saw the html of the google page.

If it just didn't work at all I would have dismissed it as broken, but obviously not completely.

The following LEDs flash now and then meaning that there is network activity. Tx only flashes just after the sketch has started, probably at the point where it tries to connect to google. COLL is constantly off.

I would very appreciate some tips on how to debug this problem.

Here is a couple of questions:

I am using the shield on a Duemilanove which is quite old, is that a problem?

I am running Linux. Can I use some command to see if there is activity from the shield? (I couldn't see anything with Wireshark).

To make it simle, I am trying the small examples for the Ethernet Library, currently the one that make a google search. I have changed it to use fixed ip (10.0.0.9) instead of DHCP.

Are you sure that is your network setting? These are what it will use:
IP = 10.0.0.9
subnet = 255.255.255.0
gateway = 10.0.0.1
dns server = 10.0.0.1

Are all these correct for your router localnet?

I have changed it to use fixed ip (10.0.0.9)

That's a rather strange looking IP address for home use.

I am running Linux.

What is the Linux box's IP address?

I am using the shield on a Duemilanove which is quite old, is that a problem?

No. My ethernet shield works fine on my Duemilanoves.

What is the shield connected to? A router or the Linux box?

#1: Yes, there are the settings I use

#2: Zyxel routers often use this IP range :slight_smile:

The shield is connected to the router.

The Linux box is 10.0.0.2

The shield is connected to the router.

Does the router know about the Arduino? Can you ping the Arduino?

Load the below code and open the serial monitor to see if the router assigned an IP address to the arduino.

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

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

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

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

  Serial.println("Starting w5100...");
  if(!Ethernet.begin(mac)) Serial.println("failed");
  else Serial.println(Ethernet.localIP());
}

void loop() {

}

It waits forever after printing the line "Starting w5100..."

Nothing happened so far after 15 minutes.

PaulS:

The shield is connected to the router.

Does the router know about the Arduino? Can you ping the Arduino?

No to both.

As mentioned in #0, the weird thing is that I actually twice did get a succesful connection out of now perhaps 200 attemtps.

No to both.

Can you configure the router to tell it that the Arduino exists, at a specific IP address that it is not to use for any other device on the network?

the weird thing is that I actually twice did get a succesful connection out of now perhaps 200 attemtps.

If some device was connected that was assigned 10.0.0.9 by the router, and then that device was disconnected, the router would then route requests to/from the Arduino correctly for a while.

The router has to understand about the Arduino so that it can route packets to it, including ping requests. The Arduino won't be able to connect until the router knows it exists, and that it should accept packets from it and route packets to it.

I have tried to assign 10.0.0.15 which is not in use to the current MAC address of the Arduino to no avail. I also tried changing the MAC address to the same value as my PC but there was no light in the COLL lamp.

I did something else for a test. I connected the shield directly to the LAN connector on my PC. It still didn't work but at least my PC sees that it is connected to a network. If I unplug it, the notification icon in the tray will show that it is not connected.

Is there are any command I can run on the Linux box to check if the specific MAC address is present on the network?

Now I suddenly make it obtain an IP from DHCP. But only one time, it's back to "normal" again.

I also tried changing the MAC address to the same value as my PC but there was no light in the COLL lamp.

Never do that. It will cause a fail. Like ip addresses, the mac addresses on the localnet must be unique. Otherwise it will not be able to connect to anything.

SurferTim:
Never do that. It will cause a fail. Like ip addresses, the mac addresses on the localnet must be unique. Otherwise it will not be able to connect to anything.

Sure, but you didn't get the point! I deliberately assigned the same mac address and would have expected the collision warning lamp to light up. It didn't, which tells me "something is rotten" :slight_smile:

Do you have a microSD card in the SD slot on the shield? If so, remove it and test it again. You might need to power down the Arduino for a few seconds to clear any faulty settings from the devices.

No SD card present. Powering down does not help.

If all the pins are connected correctly (check the ICSP pins closely to insure a connection), then you have a bad ethernet shield. :frowning:

SurferTim:
If all the pins are connected correctly (check the ICSP pins closely to insure a connection), then you have a bad ethernet shield. :frowning:

That is also my conclusion. Is it possible to send some ICSP commands to the shield to test it?

Here is my test. Upload this code. If the serial monitor shows 192.168.2.2, then you are ok on the SPI and the Arduino end of the w5100. If it returns anything else, like 0.0.0.0, then it failed.

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

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,2,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() {
}

Hmmm, it does print "Starting w5100 192.168.2.2"

What does that tell you?

That tells me that the SPI and the Arduino side of the w5100 is working. If it is still failing, it must be something on the ethernet/network end.