Using an Ethernet shield (w5100) with the Mega 2560 - can't assign an address.

Sorry if there's been a post on this already, but nothing I've looked at has solved the problem I've been having. I'm using an ethernet shield and i'm trying to connect to my local network, but I'm having trouble getting it working with my Mega 2560. At first I tried plugging the shield directly into the board and running the example sketches (I've been focusing on DhcpAddressPrinter) where the only change is the mac address provided on the product page for the ethernet shield. I'm running windows 8 64 bit, and I'm using the Arduino IDE 1.0.5. When I upload the sketches the 'Board' is set to 'Arduino Mega 2560 or Mega ADK'.

When I run the sketch, it hangs on Ethernet.begin(mac). If I try to assign an IP address it will revert to 0.0.0.0. Following the diagram on Ethernet - Arduino Reference, I've tried bending pins 13, 12 and 11 out on the ethernet shield and connecting them to pins 52, 50 and 51 (respectively) and running the sketch again, but the problem doesn't go away.

I'm fairly sure the ethernet shield is ok, as I can connect it directly to my duemilanove, reset the 'board' option and run the sketch. When it's running on the duemilanove it will assign an IP address and print it.

Is there anyone who has a fix for this? I've been trying to follow a couple different fixes but none of them have worked so far.

The newer ethernet shields use the ICSP connector for the SPI data lines. There should be no need for pin bending or jumpers if the shield has the ICSP connector.

Look closely when the Ethernet shield is on the mega that there is not a pin misalignment (been there, done that!).

The board does have the ICSP pins, but I'm unsure as to how use these over the standard pins (10-13).

As for making sure the board is in right, I'm fairly sure it is as the ICSP pins match up, as to the pin numbers on both the mega 2560 and the ethernet board (which even says 'mega compatible' on it...).

If your ethernet shield uses the ICSP, the decision is made for you. Look closely at pins 10-13 and you will see that they are not connected to anything. They are just pass-through. The shield is only connected via the ICSP group in the centre of the board and this works for both Uno and Mega.

Do you have a uSD card in the shield slot? Sometimes that will cause problems if not disabled.