Pages: [1]   Go Down
Author Topic: What is wrong with my ethernet shield  (Read 1175 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey

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:
  // initialize serial:
  Serial.begin(9600);
  // 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:");
  Serial.println(Ethernet.localIP());
  // connect to Twitter:
  connectToServer();

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?

Thanks
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8669
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
http://arduino.cc/pipermail/developers_arduino.cc/2012-April/006444.html

If not, you can apply the patch yourself to your current version. Here is the report that is now applied to the new version.
http://code.google.com/p/arduino/issues/detail?id=605

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.
« Last Edit: May 09, 2012, 06:24:29 am by SurferTim » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-lol
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

regards
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Any luck? I am in same boat.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"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?
Logged

Pages: [1]   Go Up
Jump to: