Go Down

Topic: [RESOLVED] Ethernet Shield stopping at "begin" (Read 675 times) previous topic - next topic

ShaneC

Sep 10, 2012, 02:28 am Last Edit: Sep 11, 2012, 04:54 am by ShaneC Reason: 1
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!

Code: [Select]
#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 );
}


baum

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

This code:

Code: [Select]
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

ShaneC

#2
Sep 10, 2012, 03:17 am Last Edit: Sep 10, 2012, 03:20 am by ShaneC Reason: 1

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

This code:

Code: [Select]
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.

SurferTim

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


SurferTim

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.

ShaneC

Thanks for your reply!


Are you using IDE v1.0.1?

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

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

Quote
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!

ShaneC

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.

Go Up