[RESOLVED] Ethernet Shield stopping at "begin"

UPDATE: After the lack of responses here, and the utter lack of helpfulness after Binging/Googling, I took the dive and bought a new Ethernet Shield. Ran the same code, worked on the first run. QED: Previous board was in fact a dud.

I'm having difficulties getting my Arduino Ethernet Shield working. The following code prints only "Attempting..."

I've tried the examples from the IDE and those also fail to print anything through Serial. Could this be a fault in the Ethernet shield itself? Or do you see some mitigating factor?

Any input would be greatly appreciated!

#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <util.h>
#include <SPI.h>

// SERVER CONFIGURATION
byte server[] = { /* IP */ };
byte mac[] = { 0x90, 0xA2, 0xDB, 0x0D, 0x24, 0x2B };

EthernetClient client;

void setup(){
  Serial.begin( 9600 ); // DEBUG
  delay( 5000 );
  Serial.println( "Attempting..." );
  delay( 5000 );
  if ( Ethernet.begin( mac ) == 0 ){
    delay( 5000 );
    Serial.println( "Ethernet failed to begin." );
  }else{
    delay( 5000 );
    Serial.println( "Success!" );
  }
}

void loop(){
    Serial.println( "Beginning Sequence." );
    delay( 2000 );
}

The odd thing is that you only see "Attempting..."

This code:

 if ( Ethernet.begin( mac ) == 0 ){
    delay( 5000 );
    Serial.println( "Ethernet failed to begin." );
  }else{
    delay( 5000 );
    Serial.println( "Success!" );
  }

Should either print "Ethernet failed to begin." or "Success!", no matter what.

Maybe the code is hanging within the Ethernet.begin()...

baum

baum:
The odd thing is that you only see "Attempting..."

This code:

 if ( Ethernet.begin( mac ) == 0 ){

delay( 5000 );
   Serial.println( "Ethernet failed to begin." );
 }else{
   delay( 5000 );
   Serial.println( "Success!" );
 }




Should either print "Ethernet failed to begin." or "Success!", no matter what.

Maybe the code is hanging within the Ethernet.begin()...

baum

Definitely agreed (hence the title). The odd thing is if I specify an ip (as Ethernet.begin( mac, ip)) then it gets past that bit, but other problems crop up. I want to be able to do just Ethernet.begin( mac ) and get an IP from DHCP.

Do you have a memory card in the micro SD slot?

SurferTim:
Do you have a memory card in the micro SD slot?

Nope!

Are you using IDE v1.0.1?
Is the shield connected to a router that has a dhcp server?
Have you waited a couple minutes for a fail message? Mine takes about a minute.

Thanks for your reply!

SurferTim:
Are you using IDE v1.0.1?

Yes, I've tested compiling/uploading on two machines. Both are running 1.0.1.

Is the shield connected to a router that has a dhcp server?

Yes, it's plugged directly via Ethernet into the router. I've tried two separate ports, and confirmed that plugging other devices (i.e. laptops) into those ports have resulted in the device being issued an IP.

Have you waited a couple minutes for a fail message? Mine takes about a minute.

Indeed, on one test run I just let it go for about 5 minutes while I was doing something else. No further activity beyond the above.

I'm fine with purchasing a new Ethernet Shield if this one's a dud, but I'd like to confirm it's a dud before buying a new shield which does exactly the same thing!

UPDATE: After the lack of responses here, and the utter lack of helpfulness after Binging/Googling, I took the dive and bought a new Ethernet Shield. Ran the same code, worked on the first run. QED: Previous board was in fact a dud.