Pages: [1]   Go Down
Author Topic: [RESOLVED] Ethernet Shield stopping at "begin"  (Read 591 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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 );
}
« Last Edit: September 10, 2012, 09:54:59 pm by ShaneC » Logged

Connecticut
Offline Offline
Edison Member
*
Karma: 17
Posts: 1216
RTFD (Datasheet in our case)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

This code:

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
Logged

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

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

This code:

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.
« Last Edit: September 09, 2012, 08:20:53 pm by ShaneC » Logged

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

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

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

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


Nope!
Logged

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

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

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

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

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

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

Pages: [1]   Go Up
Jump to: