Can't get the W5100 Ethernet Module and Arduino Uno R3 to work

First off, most of the post I found were about the W5100 shield, whereas I have the following hardware:

-W5100 module: https://www.itead.cc/w5100-ethernet-network-module.html
-Arduino UNO R3

I've wired the module as described in the first review on the product page yet I keep on getting server is at 0.0.0.0. when using the webserver example coming with arduino studio 1.6.12 (on Mac OS X).

I even tried the following

Usoplesk:
Thanks for the reply. You are right, it was something wrong with the MISO line. I tried this code to find out if the problem is not only with SPI bus.

#include <SPI.h>

#include <Ethernet.h>

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

void setup() {
Serial.begin(9600);

// disable SD card if one in the slot
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);

Serial.println("Starting w5100");
Ethernet.begin(mac,ip);

Serial.println(Ethernet.localIP());
}

void loop() {
}




The output of Serial monitor was 0.0.0.0. So problem was in wrong contact between Arduino and this shield.

So I properly connected it again and everything is now running right!

Thanks, it can be closed.

but that keeps on showing 0.0.0.0, I've tripled checked my connections to the UNO but can't find anything wrong.

Is there a possibility that a hardware is damaged or is there another test I could run ?

I've tried with two different routers, one Technicolor and on Apple Time Capsule, I have the opportunity to try with a Ubnt EdgeMax Router but that is in a different location so I want to rule out any other possibilities before.

Any help will be greatly appreciated.

Thanks,

You have a bad connection somewhere, or a bad IC. Check the connections carefully.

Describe how you have the pins on the w5100 module connected to the Uno.

I triple checked the connections.

Here they are in details:
Module -> Arduino

VDD -> 3.3v
NSS -> D10
MO -> D11

GND -> GND (the one right under 5V)
SCK -> D13
MI -> D12

Note that when I plug the Ethernet wire to the module and load the following sketch:

//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
//note that the below bug fix may be required
// http://code.google.com/p/arduino/issues/detail?id=605 

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x3E, 0x48 }; //physical mac address
byte ip[] = { 10,0,0, 170 }; // ip in lan assigned to arduino
//byte gateway[] = { 192, 168, 0, 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
EthernetClient client;
//////////////////////

void setup(){

  Ethernet.begin(mac, ip);
  //Ethernet.begin(mac, ip, subnet, gateway);
  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

}

I get the following lights on (From bottom to top):
PWR
LINK (this one blinks)
SPD
FDX
Rx

Then when I press 'e' I see the Tx blinking for a few seconds but it ends up failing...

VDD -> 5v (regulator onboard)
RST -> RESET

Well if I plug the RST -> Reset (the one that is right above the 3.3V on the Arduino) I get the following error when I try to upload a sketch:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00

Now switching the VDD to 5V made some difference but not on all sketches.

So when I plug VDD to 5V (but don't plug the RST pin).

Zoomkat's sketch (that I pasted previouly) doesn't work.

Yet, the Exemples->Ethernet->WebServer one is able to kick off (when using a static IP), I noticed two errors though:

  1. The serial monitor is printing a wrong IP (i.e it prints x.x.x.75 when I specificy an IP x.x.x.77)
  2. If I try to open x.x.x.75 on my browser nothing happens, yet if I try to access x.x.x.77 I get the following logged on the serial monitor (but the browser keeps on loading and returns nothing untill I hit cancel to stop the flood on the serial monitor)
new client
GET � / GET / @TTP/1.1
a(�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������client disconnected

Worthy to note that I can also ping x.x.x.77

Your ethernet module must have capacitance on the RST pin if you can't upload a sketch with the RST pin connected to RESET. You can test that by pressing the RESET button on your Arduino board until the IDE says "Uploading", then release it. If it uploads successfully, then that is the problem.

If you use zoomkat's sketch, it is subject to the character flood. The IDE example shouldn't. This example in the playground certainly has no problems.
http://playground.arduino.cc/Code/WebClient

Indeed, pressing Reset right after the upload button then waiting for the IDE to show uploading... to release the reset button on the Arduino made it work (yet the timing is quite critical). Is there any other solution for the capacitance on the RST (and is it normal ?).

Now for the example you linked to, I tried the GET method (the first one) and here is what I'm getting:

Sta11.0.0.0
Ready
connecting...failed
Fail 1

Yet I want to try on another network equipment to rule out the possibility of an issue with the router I'm connecting the Module to, unless you have an idea of what might be wrong and think another test might be usefull.

Thanks

You have a problem on the SPI side of the module. If the IP is not showing what you assigned with your code, the SPI bus or SPI side of the w5100 has failed.

You should not have the IP printing before the "Starting ethernet" is finished printing.

Check your wiring carefully. Check the w5100 for solder bridges.

Thanks SurferTim for the help, yet to be quite frank I'm not really sure on how to check the solder bridges.

The wiring has been made as I usually wire up modules to the Uno and I've tried to use different wires (in case the wires were causing the issue) to no avail.

I'm quite a newbie with electronic components but eager to learn which means that more details would be greatly appreciated.

Thanks

Hmm some changes here,

Now your code is outputting the correct IP address, yet it keeps on outputting the following:

Starting ethernet...
10.0.0.33
Ready
connecting...failed
Fail 1
connecting...failed
Fail 2

etc...

Any idea ?

According to what I see you try to load Google's page, I've removed the use of DNS to rule this out to no avail.

I also tried to ping the module on the IP it shows but it timeout and an arp -a command shows that 10.0.0.33 has no Mac address:

? (10.0.0.33) at (incomplete) on en0 ifscope [ethernet]

Yet the Arduino IDE WebServer Exemple keeps on outputting a wrong IP address, yet now I can't even ping the Arduino neither do I see any output when trying to open the page...

Since wiring might be wrong here, I've attached a picture of how I wired the module to the arduino.

If the sketch is returning the correct IP address, it would seem the wiring is correct.

Do the networks settings in the Arduino agree with the localnet settings in your router?

edit: Have you tried using the DHCP network setup in my example sketch?

Answer to your question is yes I made sure to provide an IP that is in the range of my router's network.

To move forward, I've tried with another router (a Cisco Linksys E1000 with the exact same wiring and power supply).

Now the IP it shows is totally wrong, yet when I ping and/or try to access the Arduino through the console I'm getting logs when running the webserver exemple but it seems that it's looping and the browser is loading... then I get

Starting server...
server is at 192.80.1.117
new client
GET / HTTP/1.1
Host: 192.l68.1.117
Connection: keep-alive
Upgrae-[nsec�re-Requests: 1
Save-Data: on
User-Agent: Mozilla/5.0 / HTTP/1.1
Host: 192.68.1.117
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Save-Data: on
ser-Agent: Mozilla/5.GET / HTTP/c.1
Host: 192.1l8.1.117
[...]
client disconnected

See in the logs how the initial IP is wrong and how the host is randomly changing...

At the end on the browser I sometimes get some gebrish characters returned and in the console monitor I often get characters which are not recognized or truncated strings:

Host: 192.168.1.117
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Save-Data: onTTP/1.1
Host: 192.168.1.117
Connection: keep-alive
CacheControl: max-age=0
Upgrade-Inse�ure-Requests: 1
Save-�ta: on
Us.1

Does it shed light on a possible other issue ?

When I try to run your code, I can see the Tx/Rx leds blinking but nothing happens on either the browser or the Console log.

I'm TOTALLY lost :frowning:

Looks like you have a problem. It is difficult to tell if it is the SPI bus or the w5100.

Hmmm do you have an idea on how can I "debug" the situation ?

I'm not very familiar with SPI bus or the W5100... but aren't both on the module I bought ? or is SPI related to the arduino ?

If it's arduino related could I run a test with other components on the Arduino (like leds, resistors etc...) to see the board has a defect or not ?

And if it's the Ethernet Module, can I do any type of test to see if the issue comes from the module ?

As you can see I'm a newbie here so any suggestion would be greatly appreciated.

Thanks

Edit: By the way I've never been able to have an IP in DHCP mode, it always return 0.0.0.0 as an IP

The pic above of your wiring appears to have your Vdd pin connected to 3.3v. The ethernet module has a voltage regulator on it. It will not operate reliably with 3.3 volts as the power supply.

This is from the module page you posted:
"Connect 5v to power this module(you cannot supply 3.3v, since VDD goes to the Voltage Regulator, so you have to supply 5v, despite the fact that the logic is 3.3v)"

Indeed when plugged on 3.3V it doesn't work at all.

And on the pic it's plugged on the 5V (you can see that GND is second pin from the bottom, right after Vin and that the red wire is one PIN away from the Reset... so the 5V)

I was also checking this page: SPI - Arduino Reference to understand this better but couldn't find a way to test SPI on the arduino or on the W5100 module.

Also note that leaving the module plugged (even if not functional) result is heat being dissipated form the chip (I guess that's the norm but preferred to mention it, just in case)

The Wiznet ICs do get real warm.

You already tested the SPI side of the w5100. This is the test code I wrote. If this code does not display 192.168.2.2, the SPI bus or the SPI side of the w5100 is failing. You stated it displays 0.0.0.0. That is a fail.

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

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

void setup() {
 Serial.begin(9600);

 // disable SD card if one in the slot
 pinMode(4,OUTPUT);
 digitalWrite(4,HIGH);

 Serial.println("Starting w5100");
 Ethernet.begin(mac,ip);

 Serial.println(Ethernet.localIP());
}

void loop() {
}

Well now with this wiring and router, it display 192.80.2.3 still a fail I guess though...

But how can I know which side is failing ? And does it mean I have to change the hardware or could it be coming from somewhere else ?

Thanks

Unless you have another Arduino or SPI device, it would be difficult to troubleshoot. I presume you do not have an oscilloscope.

edit:...or a logic analyzer.

Well I got my hands on another board, an Arduino Nano.

I wired it the same way I wired the Uno and loaded the webserver example into it.

It worked right away with no further tweaking...

It seems my board has an issue, is it something I can fix or do I need to get another board ?

Thanks for all your help.