Ethernet Shield + arduino uno freeze

If i try to use Ethernet Library it seems that the board freeze, somewhere before entering setup().

I tried the following code:

#include <Ethernet.h>

int buttonPin = 2;                 // LED connected to digital pin 13

int val = 0;         // variable to store the read value
int buttonState = 0;
byte mac[]    = {  0x90, 0xA2, 0xDA, 0x0D, 0x40, 0x42 };
byte server[] = { 192, 168, 1, 104 };
byte ip[] = { 192,168,1,177 };
//IPAddress ip(192,168,1,177);
int counter;

//EthernetClient ethClient;
/*PubSubClient client(server, 1883, callback, ethClient);*/

void setup()
  counter = 1;

void loop()

It seems that when i run the sketch on the board nothing happens (if i open the serial monitor it stay blank even if i have several Serial.println in my sketch, and even if i put Ethernet.begin as last line in setup function).

I tried to remove Ethernet.begin and EthernetClient lines and the sketch works well, but if i just readd one of those lines, the problem re-appear.

I also tried to give the shield a static Ip, but without success

Any idea?

Insure you include SPI.h. The w5100 will call SPI.begin() in it’s init function.

#include <SPI.h>
#include <Ethernet.h>

Yes, i have tried with and without SPI.h but it doesn't solve the problem.

Do you have a SD card in the shield’s slot? If so, remove it and try it again.

Try this test code. Does it display anything on the serial monitor?

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,2,2);

void setup() {

  // disable SD SPI

  // Start ethernet
  Serial.print(F("Starting ethernet..."));
  Ethernet.begin(mac, ip);


void loop() {

There is no SD Card in the ethernet shield.

I tried, your code, but the serial monitor is empty.

Sounds like an ethernet shield problem. Have you checked your w5100 IC for solder bridges? I've seen a lot of that causing problems.

Here is a pic of a w5100 with solder bridges. The red arrows point to them. Those should not be there.

Client test code you can try to see if you get a response from the IP server.

//zoomkat 11-04-13
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test client GET
//for use with W5100 based ethernet shields
//remove SD card if inserted
//data from myIP server captured in readString 

#include <SPI.h>
#include <Ethernet.h>
String readString;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = ""; // zoomkat's test web page server
EthernetClient client;


void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:

  Serial.println("client readString test 11/04/13"); // 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 =; //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(serverName, 80)) {  //starts client connection, checks for connection
    client.println("GET / HTTP/1.1"); //download text
    client.println("Connection: close");  //close 1.1 persistent connection  
    client.println(); //end of get request
  else {
    Serial.println("connection failed"); //error message if no client connect

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c =; //gets byte from ethernet buffer
    readString += c; //places captured byte in readString

  client.stop(); //stop client
  Serial.println("client disconnected.");
  Serial.println("Data from server captured in readString:");
  Serial.print(readString); //prints readString to serial monitor 
  Serial.println("End of readString");
  readString=""; //clear readString variable


Tried, but again without success. No output on serial Monitor.

I tried to check the w5100 ic (i used a 20x webcam) but i cannot find any solder bridge.

I did another test, i don't know if it helps, but if in setup function i turn on the board led, it is turned on, but if i trie to turn it off, after a small delay, it doesn't work. And it seems that the loop function is never called.

The board seems to work (at least i with basic sketches that doesn't involve ethernet shield).

So it works even with the ethernet shield connected as long as you don't call Ethernet.begin()? Have you checked the 5v pin for 5 volts? May be a power issue?

I'm heading to the beach to catch a few waves. Maybe I'll come up with something else while surfing.

If the ethernet shield is connected, but i don't call any of the Ethernet Functions the board seems to work properly.

The problems start only when i try do call Ethernet.Begin, or declare a EthClient variable, etc. Anyway, i'm going to do two more tests:

  1. Try to change arduino
  2. Try to upload the sketch with a different OS.

I did another test, i don't know if it helps, but if in setup function i turn on the board led, it is turned on, but if i trie to turn it off, after a small delay, it doesn't work. And it seems that the loop function is never called.

I think the arduino pin 13 with the LED is used as a timing pin for the ethernet shield. If you look closely in a dark environment while the ethernet shield is in use, you will notice it has a faint glow.

DId some tests.
It seems to be a software problem related to linux.

I tried to upload the same sketch from a macbook, and the shield worked perfectly. Tried several examples without any problem.

Then the problem is somewhere in the software. Currently i'm using arduino ide 1.0.5 on gentoo linux system.

I use IDE v1.0.5 on a Ubuntu Linux system, but not the version from the repository. Did you download the IDE from the Arduino website?

No, the arduino that i'm using, is installed using gentoo package manager (emerge).

The version of avr-gcc is 4.6.3

Then I recommend downloading and unpacking the IDE from the Arduino site. You can have both (or all) IDE versions on one Linux box. Unpack the IDE into a local directory, then navigate to that directory and run the arduino batch file there. That IDE version contains its own versions of avr-gcc and the avr libraries.

The IDE I installed from the Ubuntu repository was very buggy.

Tried with the Arduino IDE downloaded from website, and now the ethernet shield works.

So the problem was in the Arduino that i installed from repositories.