Go Down

Topic: What is wrong with my ethernet shield (Read 1 time) previous topic - next topic



I have a duemilanove with an ethernet shield which I use (well until recently at least) to control my lights from an android tablet, by running a small webserver on the Arduino.
To test some new stuff I loaded other code on the Arduino, however when I switched back to my other code it did not work anymore.

The Arduino itself seems to do fine, but I don't get the network shield to work anymore. I've tried every library and example I could find, but I can't get something to work on the network shield.
For example, when i try the code from http://arduino.cc/en/Tutorial/TwitterClient, which contains:

Code: [Select]
  // initialize serial:
  // attempt a DHCP connection:
  Serial.println("Attempting to get an IP address using DHCP:");
  if (!Ethernet.begin(mac)) {
    // if DHCP fails, start with a hard-coded address:
    Serial.println("failed to get an IP address using DHCP, trying manually");
    Ethernet.begin(mac, ip);
  Serial.print("My address:");
  // connect to Twitter:

My serial monitor shows "Attempting to get an IP address using DHCP:", and then nothing. So I even don't get to the error.
Also examples with fixed IP's don't work, even if I add mac and IP to the router (which seemed to be necessary when it worked earlier).

At least the lights on the network connector work...

Does anybody have an idea what is going on or what I should try?



How long did you wait?  It could take a while to get an address from your local DHCP server.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


How long did you wait?  It could take a while to get an address from your local DHCP server.

Well, a few minutes. The computers take only seconds to do that, so I guessed I shouldn't wait for an hour?


May 09, 2012, 01:18 pm Last Edit: May 09, 2012, 01:24 pm by SurferTim Reason: 1
It should get an ip or timeout within 2 minutes.

The ethernet library had a bug that caused the dhcp routine to fail like that. The newest version (IDE v1.0.1) has been patched. If you want to try that, here is the link to the newest version test release.

If not, you can apply the patch yourself to your current version. Here is the report that is now applied to the new version.

edit: I have also seen that fail if there is a microSD card in the slot on the shield, and it is not disabled or initialized.


I tested examples like the DHCPadressprinter with the IDE v1.0.1, but it seems to fail in getting an address (doesn't show any response on the serial monitor). I have a networkshield without it's own mac-address, so is it correct that you can use whatever mac-address you want (different from those in your network of course)?

Is there a sort of diagnostic script to run? I don't mind if it's broken, but I would like to know if it is not me doing something stupid  XD


I just tested the DhcpAddressPinter script. It crashed like the Hindenberg. It does not return from the Ethernet.begin() call. I knew it would tho. I have a microSD card in the slot and I did not disable the SD SPI interface. When I disabled it, or removed the SD card from the slot, it did fine.

Could that be your problem?


Which OS are you running on ?
Maybe you recently changed the toolchain ?
I had on linux similar problems which where toolchain related. Maybe this helps you: http://arduino.cc/forum/index.php/topic,95741.msg734762.html#msg734762



I had the same exact problem. It would hang endlessly on the Ethernet.begin. This happened recently and I was scared I shorted something. Anyway, I updated to 1.0.1 and initialized the sd card and it works great now! Thanks  :)


I have a microSD card in the slot and I did not disable the SD SPI interface. When I disabled it, or removed the SD card from the slot, it did fine.

The SD slot is empty, and I also tried with disabling it (pin 4 I believe).

Which OS are you running on ?

Win 7, but I doubt if that's the problem.
However, your question gave me an idea: I do have my old laptop that I previously (successfully) used for the Arduino somewhere at work... Let's try that one...



"Same boat" means your sketch hangs in the Ethernet.begin(mac) function longer than 2 minutes?

Are you using IDE v1.0.1? Do you have a sd card in the slot? Have you tried the DhcpAddressPrinter sketch in the ethernet examples?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131