Problem getting EthernetShield working

Hello, I'm new to the Arduinos and have problems getting the Ethernet SHield working.
HW: Mega 2560, new Ethernetshield with W5100 (Connector left, reset button and regulator left, SD right, LEDs up right)
As far as I understand, I only have to use eg. the FILE->Examples->ETHERNET->DhcpAdressPrinter.

When I do that, no connection to the Router, Power is on.
Ethernetcable plug in: Link, 100M, Fulld light up. every some seconds LINK goes off while RX light on, TX stays off.
So, looks like there is connection. But no message on the SERIAL Monitor, and not visible in the network (checked with nmap), No IP is given out.

Do I have to configure something?
Any other idea but : give it back, you are to stupid?

Any help apprechiated,
Ingo

dhcp depends on a dhcp server to issue an address. It will take a couple minutes to timeout, but it should timeout.

Try this. You don't even have to change the ip. This is designed to test the SPI connection to the w5100. If it displays 192.168.2.2, the SPI connection to the w5100 is working.

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

Spell check! :slight_smile:

My apology for any typos. :roll_eyes:

First of all,Thanks for reply. I used your code (SurferTim), but I get:

Starting w5100
0.0.0.0

as answer. Does that mean, there ist an SPI error? No SPI Bus-connection? if so, I will have to look with an oscilloscope.

To clarify, when I use the above described EthernetSHield, do I only have to stick it to the mega2560 or do I have to make any more connections or something else?

When I read on the net, it looks like: stick the two PCB together, use the samplecode, it works. I sit like that, or do I have to do something else?

Ingo

P.S. I use an open source version of English and German. I am allowed to modify, as long as I publish it. :wink:

Check the pin alignment between the mega and ethernet shield. I recently got a mega and a new ethernet shield and noticed one has to be careful to make sure the pins go in the correct holes.

O.K., that's it. I checked both PCBs, connection from Mega to Connectors and W5100 to Connectors. Everything o.K.
Then sticked both together an check Connection between them. MOSI Pin no connection. It was the Header on the Ethernetshield. I have to bend the Pin on the Mega a little bit, so it sticks skew (not upright??) in the Connector.
Cool, i can get ethernet with a controller :slight_smile:
That's what I dreamed of years ago (beside others)
Thanks for the help,
Ingo

You made my day.

I had exactly the same problem and wasted =( a couple of hours on this until I found your solution.

Thanks a lot !!

Muetze303