Ethernet sheild(W5100) not working with Uno

Hello,
I am using the W5100 Ethernet shield with the Arduino Uno. I have uploaded the DHCP Address printer code which comes pre installed in the examples. I seem to have a problem connecting to the network.

None of the lights other than the FULLLD led on the shield blink after connecting the ethernet cable. However if I connect the sheild to my PC through a LAN cable and monitoring it using Wireshark I see that all lights blink and there is some communication happening between the PC and the shield.

I tried to debug this issue by placing some Serial.print statements in the ethernet library and i found out that the arduino reads back 0xFF when it tries to search for a socket(value of SnSR register in W5100). Since it does not get a socket it cannot start the DHCP communication.

On further investigation I found that this is the case with the other registers as well. Always the value read back is 0xFF even though a different value is written to the register just before reading.

Since i do not have a SPI protocol sniffer i am unable to determine if this is some SPI issue. I have disabled the SPI for the SD card on the ethernet sheild but still this problem persists. Is this a HW issue with my Uno or with the Ethernet shield. It is difficult to determine physical connections to the chips since they are SMD packages.

Has anyone else faced this problem? and if you have a solution please let me know.

Client test code you can try unmodified to see if you can get a response from the server. If this works, then your hardware and network setup are probably ok.

//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 weather 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[] = "api.openweathermap.org"; // myIP server 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:
    while(true);
  }

  Serial.begin(9600); 
  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
  Serial.println();
}

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(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /data/2.5/weather?zip=46526,us HTTP/1.1"); //download text
    client.println("Host: api.openweathermap.org");
    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
    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
    readString += c; //places captured byte in readString
  }

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

}

Assuming there is not a bug in the code you are using:

There are 3 common problems with cheap chinese clones of these shields ...

  1. No ip address and no matter how often you reset it it never sticks ... this seems to be a SPI connection issue. Ensure your shield is correctly seated.
  2. No ip address or a random one on start. If you press the reset button and it restarts it works.
  3. IP address sticks and when directly connected to a PC it works but through a switch you cannot communicate.

I believe both relate to a widespread issue impacting cheap chinese clones of the arduino ethernet modules which incorrectly include a 510 Ohm resistor network (labelled 511) on the network cable connection instead of the specified 49.9 Ohm resistor network.

In a few days I hope to prove this when some replacement resistor networks arrive and i replace mine.

@zoomkat - i found and already tried your code based on previous posts about Ethernet shield problems but it doesn't work since the issue is not with the code but probably with the shield.

@keithsw1111 - thanks for the info. could you pls keep me posted in case you find any solution or if you find out the root issue with the board? i will also try replacing the resistor and see if that works.

Do you have a SD card in the shield's slot?

I believe both relate to a widespread issue impacting cheap chinese clones of the arduino ethernet modules which incorrectly include a 510 Ohm resistor network (labelled 511) on the network cable connection instead of the specified 49.9 Ohm resistor network.

I've got a couple of clone w5100 based ethernet shields and they all work. Do you have any technical links to board layouts or schematics showing the suspect 510 Ohm resistor so I might be able to check my shields to see if that particular resistor is installed?

zoomkat:
I've got a couple of clone w5100 based ethernet shields and they all work. Do you have any technical links to board layouts or schematics showing the suspect 510 Ohm resistor so I might be able to check my shields to see if that particular resistor is installed?

i do not have link to the schematic but i found this pic online. https://www.arduino.cc/en/uploads/Main/ArduinoEthernetShield_R3_Front.jpg
If you see the value of the resistor(the one with 4 legs) just opposite to the ethernet RJ45 connector its 49.9 ohms. The one in my shield has a value 510 ohms.

SurferTim:
Do you have a SD card in the shield's slot?

no i dont. anyway i disable the sd card slave select in my code.

If you see the value of the resistor(the one with 4 legs) just opposite to the ethernet RJ45 connector its 49.9 ohms. The one in my shield has a value 510 ohms.

The layout on my clone is somewhat different than the shield in the pix. The resistor (it seems to be four resistors), on two of my clones has 511 on it, and these shields don't have any issues so far.

edit:

Per the below chart, 510 would be 51 ohms and 511 would be 510 ohms.

http://www.marsport.org.uk/smd/res.htm

zoomkat:
The layout on my clone is somewhat different than the shield in the pix. The resistor (it seems to be four resistors), on two of my clones has 511 on it, and these shields don't have any issues so far.

edit:

Per the below chart, 510 would be 51 ohms and 511 would be 510 ohms.

SMD Resistor marking

then i dont know what could be the problem. i guess i will buy a spi sniffer and check the communication between arduino uno and the ethernet shield. its a useful toy to have :slight_smile:

then i dont know what could be the problem.

Make sure the ethernet shields are in the proper holes on the arduino. I've had misaligned pins in the past.

i got the shield working now. but i dont know what exactly i did to get it working. i just checked the hw connections. and then re inserted the shield into the arduino uno. i am able to get the DHCP discover message on wireshark. but it is not able to connect to my router. i have enabled DHCP on my router. my pc is able to connect. any ideas about how to resolve this problem?

You see a DISCOVER packet? Do you see an OFFER packet from the DHCP server?

i cannot see the OFFER packet from the router.

i shared the wifi connection of my pc over the ethernet port and then connect arduino and monitor using wireshark but no OFFER packet is sent to the arduino by the PC. i can see a bunch of other protocol messages being sent(ARP etc). will this work?

directly connecting the arduino to the router through a LAN cable also does not work. in that case i will not be able to monitor the LAN bus so i bought a LAN splitter(http://www.ebay.in/itm/171919472189?aff_source=Sok-Goog&aff_source=Sok-Goog) but i do not have a test result with the splitter since i need an additonal cable and i am waiting for it to arrive. i tried to connect router with my pc over lan but nothing happens. so i am guessing that i cannot monitor the LAN bus like you can monitor CAN, SPI etc.

as you can see my knowledge about ethernet is limited so pls help me out. if you have any other way of debugging do let me know. tia!

Then that is a network problem. I don't know anything about how you shared your PC connection.

http://www.countrymilewifi.com/how-to-share-computers-wifi-with-ethernet-devices.aspx

i shared it as described in the above link.

btw i noticed one thing. After reset only the FULLD light blinks. but if i leave the board as it is after some time all the lights are on.

keithsw1111:
I believe both relate to a widespread issue impacting cheap chinese clones of the arduino ethernet modules which incorrectly include a 510 Ohm resistor network (labelled 511) on the network cable connection instead of the specified 49.9 Ohm resistor network.

In a few days I hope to prove this when some replacement resistor networks arrive and i replace mine.

I replace mine with 680=68ohm and start to working. its not 49.9 but i think will do the job.

Hi keithsw1111, i wonder if your replacement of the resistor network with 49R9 worked? All the schematics I've seen have 49R9 fitted. I have similar problems to yours running an UNO and a chinese clone wiznet board.
Joe.

keithsw1111:
Assuming there is not a bug in the code you are using:

There are 3 common problems with cheap chinese clones of these shields ...

  1. No ip address and no matter how often you reset it it never sticks ... this seems to be a SPI connection issue. Ensure your shield is correctly seated.
  2. No ip address or a random one on start. If you press the reset button and it restarts it works.
  3. IP address sticks and when directly connected to a PC it works but through a switch you cannot communicate.

I believe both relate to a widespread issue impacting cheap chinese clones of the arduino ethernet modules which incorrectly include a 510 Ohm resistor network (labelled 511) on the network cable connection instead of the specified 49.9 Ohm resistor network.

In a few days I hope to prove this when some replacement resistor networks arrive and i replace mine.

sorry psyazax,
I didn't notice your post (noobie) - glad to hear you got it working. BTW HanRun (who make the ethernet Tx/Socket, show 75 ohms - so 68R looks like a good compromise. I haven't got a network resistor, but do have separate SMD resistor, so will try this amanha. Regards, Joe.

psyazax:
I replace mine with 680=68ohm and start to working. its not 49.9 but i think will do the job.

The Ethernet twisted-pairs are transmission lines that really need 100 ohm differential termination, 2 each 49.9, per the reference schematic, or 2 each 51 would be ok too. But without proper termination, it is easy to be on (or beyond) the fringe of workability. On the fringe, one cable might appear to make things work, where another doesnt.
As noted, the problematic boards are coming with 2 each 510 ohm, per measurement and per their 511 marking, 51*10^1.
An easy and satisfactory solution is to come up with a couple of 100 to 120 ohm resistors to tack across the HanRun connector pins. One goes between pins 1 and 2, the other between pins 3 and 6. Leave the bogus resistor pack in place, it works to supply the necessary bias. No need to fiddle with sourcing and changing the tiny pack.
I just received additional boards from a US ebay vendor whose picture showed 510 marking (51 ohm), but 511 on the batch received. Added the discrete resistors (100 ohm on hand) and the Ethernet waveforms are close to picture perfect.
The built-in 75 ohm resistors in the HanRun mag jack are not differential signal terminating resistors, they are involved with common-mode behavior, tied to the center taps of the transformers.
Ed

2 Likes