I use BoArduino for my Arduino work because I prefer breadboards. I do however have a WickedProto Shield adapter for the odd occasion I want to play with "standard" Arduino shields, and it has always worked great in the past. Last weekend I picked up an Ethernet Shield from Radio Shack (want to support their new Arduino efforts) and I'm having zero luck getting it going.
Running the DHCP Chat Server example sketch in Arduino 1.0, the serial monitor shows it waiting indefinitely for a DHCP address (network is tested and valid). If I comment out the DHCP initialization and use static parameters, Ethernet.localIP() always returns 0.0.0.0.
Below is some ethernet test code that you can try. Youmay need to change the assigned lan ip to match your setup.
//zoomkat 12-08-11
//simple client test
//for use with IDE 1.0
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan assigned to arduino
//byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
//byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
byte myserver[] = { 208, 104, 2, 86 }; // zoomkat web page server IP address
//Client client(myserver, 80); // connect to web server using port 80
EthernetClient client;
//////////////////////
void setup(){
Ethernet.begin(mac, ip);
//Ethernet.begin(mac, ip, gateway, subnet);
Serial.begin(9600);
Serial.println("Better client test 12/01/11"); // so I can keep track of what is loaded
Serial.println("Send an e in serial monitor to test"); // what to do to test
}
void loop(){
// check for serial input
if (Serial.available() > 0) //if something in serial buffer
{
byte inChar; // sets inChar as a byte
inChar = Serial.read(); //gets byte from buffer
if(inChar == 'e') // checks to see byte is an e
{
sendGET(); // call sendGET function below when byte is an e
}
}
}
//////////////////////////
void sendGET() //client function to send/receive GET request data.
{
if (client.connect(myserver, 80)) { //starts client connection, checks for connection
Serial.println("connected");
client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
client.println(); //end of get request
}
else {
Serial.println("connection failed"); //error message if no client connect
Serial.println();
}
while(client.connected() && !client.available()) delay(1); //waits for data
while (client.connected() || client.available()) { //connected or data available
char c = client.read(); //gets byte from ethernet buffer
Serial.print(c); //prints byte to serial monitor
}
Serial.println();
Serial.println("disconnecting.");
Serial.println("==================");
Serial.println();
client.stop(); //stop client
}
Better client test 12/01/11
Send an e in serial monitor to test
connection failed
disconnecting.
Which is as expected as Ethernet.begin is failing to initiate the shield. This is why Ethernet.localIP is returning 0.0.0.0 in my code. Now the question is, is this because the Ethernet Shield is somehow incompatible with BoArduino or is this shield defective...
I've now tested this thing on multiple networks and even tried crossover cables direct to my laptop. Even sniffed the traffic and absolutely nothing comes out of the Ethernet Shield when attempting DHCP so I'm thinking its a bum unit. Guess I'll swap it out at RS.
Even sniffed the traffic and absolutely nothing comes out of the Ethernet Shield when attempting DHCP so I'm thinking its a bum unit.
Is your UNO recognized when it is plugged into a router? When I run the code my netgear router provides the IP and I can see the wiznet in the connected devices.
I'm not using an UNO, but no the Ethernet Shield is never seen by the network and does not appear in the ARP table. Using code which would initiate a DHCP request hangs at Ethernet.begin(mac) indefinitely. Statically assigned IP via Ethernet.begin(mac, ip, gateway, subnet) does complete but Ethernet.localIP() always returns 0.0.0.0 and the Shield still never appears in ARP.
I use BoArduino for my Arduino work because I prefer breadboards. I do however have a WickedProto Shield adapter for the odd occasion I want to play with "standard" Arduino shields, and it has always worked great in the past.
After rereading the above, I suspect that is where your problem is and not the ethernet shield from RS.
As Arduino is Open Source Hardware, that would be unfortunate, if true.
If it is true, and I would tend to agree that it possibly is, all that it means is that the problem is with your "Arduino", not with the Rat Shack shield.
You would then need to look more closely at your hardware.
While I'm new to this forum, and it's easy to assume the newbie doesn't know much, I can assure you this isn't my first time around the workbench. Even won some design awards many moons ago in Nuts and Volts...
I was hoping someone had some advice on validating proper Ethernet Shield operation at the SPI level as the Arduino Ethernet library, even in 1.0, does a very poor job of providing feedback on what's happening inside the w5100. This may be beyond the scope of the regulars here though, I'm guessing. I'll pop over to adafruit's board and see if anyone there has messed with the 'duino Ethernet Shield.
...and the Mega owners should take note also. Since pins 11-13 are not wired, they are available for general use without interfering with the ethernet shield. The Mega does not use those pins for SPI.
I've now tested this thing on multiple networks and even tried crossover cables direct to my laptop. Even sniffed the traffic and absolutely nothing comes out of the Ethernet Shield when attempting DHCP so I'm thinking its a bum unit. Guess I'll swap it out at RS.
So is the ethernet shield going back to radio shack? The below may explain the 0.0.0.0 issue using the 1.0 IDE.
Did I miss something? The Radio Shack ethernet shield works just like the Arduino ethernet shield. Both use the ICSP connector. Any shield that wants to use the SPI and maintain compatibility with the Mega series must use that.