Go Down

Topic: Ethernet Shield cannot connect (Read 2083 times) previous topic - next topic

marlar

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).

SurferTim

Quote
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?

PaulS

Quote
I have changed it to use fixed ip (10.0.0.9)

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

Quote
I am running Linux.

What is the Linux box's IP address?

Quote
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?

marlar

#1: Yes, there are the settings I use

#2: Zyxel routers often use this IP range :-)

The shield is connected to the router.

The Linux box is 10.0.0.2


PaulS

Quote
The shield is connected to the router.

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

zoomkat

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

Code: [Select]

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

}

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

marlar

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

Nothing happened so far after 15 minutes.

marlar


Quote
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.

PaulS

Quote
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?

Quote
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.

marlar

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?

marlar

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

SurferTim

Quote
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.

marlar


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" :-)

SurferTim

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.



marlar

No SD card present. Powering down does not help.

Go Up