Pages: [1]   Go Down
Author Topic: [RESOLVED] Brand new ethernet shield will not connect to network  (Read 992 times)
0 Members and 1 Guest are viewing this topic.
Sydney, Australia
Online Online
Edison Member
*
Karma: 27
Posts: 1179
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I recently bought a WizNet 5100 based ethernet + SD shield (R3?) after having used an ENC28J60 based shield.UNfortulately I am having problems trying to get this new shield to connect to the network, so I need some collective intelligence applied to this problem...

1. The power LED lights up so I know I have power. Uno is powered off the USB port.
2. The etherent LEDs on the 'HanRun' network socket do not light up. The cable plugged into a laptop works fine, so the network is operational.
3. The Webserver sketch from the IDE examples echoes ther IP address to the serial port but does not allow connections (maybe not surprisingly given 2 above). MAC address is as per sketch and the IP address is in the range for the rest of the network with no duplication.

I have corrected some solder bridges on the Wiznet chip (lower row in the picture) and there appear to be a few other on pins that look like they should be connected anyway (vertical row).

I am running an Uno board with version 1.0.1 IDE. The board is 'brand new' and I have the option of returning it, but I want to try to get it working before I invest time and money in the returns process.

Any ideas on what I can try would be appreciated.


* Ethernet shield.jpg (224.7 KB, 768x576 - viewed 31 times.)
« Last Edit: July 14, 2012, 07:52:44 pm by marco_c » Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8907
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Below is some combined client/server code for testing. This works when the arduino ethernet shield is connected to a router.

Code:
//zoomkat 7-03-12, combined client and server
//simple button GET with iframe code
//for use with IDE 1.0
//open serial monitor and send an g to test client and
//see what the arduino client/server receives
//web page buttons make pin 5 high/low
//use the ' in html instead of " to prevent having to escape the "
//address will look like http://192.168.1.102:84 when submited
//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[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //assign arduino 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
EthernetServer server(84); //server port arduino server will use
EthernetClient client;
char serverName[] = "web.comporium.net"; // (DNS) zoomkat's test web page server
//byte serverName[] = { 208, 104, 2, 86 }; // (IP) zoomkat web page server IP address

String readString; //used by server to capture GET request

//////////////////////

void setup(){

  pinMode(5, OUTPUT); //pin 5 selected to control
  Ethernet.begin(mac,ip,gateway,gateway,subnet);
  server.begin();
  Serial.begin(9600);
  Serial.println("server/client 1.0 test 7/03/12"); // keep track of what is loaded
  Serial.println("Send an g in serial monitor to test client"); // what to do to test client
}

void loop(){
  // check for serial input
  if (Serial.available() > 0)
  {
    byte inChar;
    inChar = Serial.read();
    if(inChar == 'g')
    {
      sendGET(); // call client sendGET function
    }
  } 

  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string
          readString += c;
          //Serial.print(c);
        }

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging

            //now output HTML data header
          if(readString.indexOf('?') >=0) { //don't send new page
            client.println("HTTP/1.1 204 Zoomkat");
            client.println();
            client.println(); 
          }
          else {   
            client.println("HTTP/1.1 200 OK"); //send new page on browser request
            client.println("Content-Type: text/html");
            client.println();

            client.println("<HTML>");
            client.println("<HEAD>");
            client.println("<TITLE>Arduino GET test page</TITLE>");
            client.println("</HEAD>");
            client.println("<BODY>");

            client.println("<H1>Zoomkat's simple Arduino 1.0 button</H1>");

            client.println("<a href='/?on' target='inlineframe'>ON</a>");
            client.println("<a href='/?off' target='inlineframe'>OFF</a>");

            client.println("<IFRAME name=inlineframe style='display:none'>");         
            client.println("</IFRAME>");

            client.println("</BODY>");
            client.println("</HTML>");
          }

          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf("on") >0)//checks for on
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led On");
          }
          if(readString.indexOf("off") >0)//checks for off
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

//////////////////////////
void sendGET() //client function to send and receive GET data from external server.
{
  if (client.connect(serverName, 80)) {
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0");
    client.println();
  }
  else {
    Serial.println("connection failed");
    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();
    Serial.print(c);
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop();

}


Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Sydney, Australia
Online Online
Edison Member
*
Karma: 27
Posts: 1179
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Interesting thing just happened!

Plugged the board back in and the network cable and it all lit up correclty - so the board can work...

@zoomcat - the test worked fine and I got a response from your server.

Unplugged the board and cable, put it back together and it is now not working any more. I hate intermittent faults (although this is more like intermittent working).

« Last Edit: July 14, 2012, 06:26:54 am by marco_c » Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Sydney, Australia
Online Online
Edison Member
*
Karma: 27
Posts: 1179
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Still not working but I have filldled enough. I'll organised a replacement.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

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

@marco_c , in the WebServer example sketch from Arduino 1.0.1, after the line if(c == "\n" ... I think the client.print... commands should be changed to server.print... except for the last one client.stop() . I think this is the same problem from mrbubl3s in 2010 on the old forum. If somebody agrees with this, maybe the example code and page should be updated.

What I tried was combining the WebServer example with the Arduino Data Server code from Hari (http://arduino.cc/forum/index.php/topic,6595.0.html#0), and then I was able to see the text output printed by server.print commands via a browser pointed to the arduino's ip. Note that in Hari's code example, you need to change "Client" to "EthernetClient" and "Server" to "EthernetServer" for the class definitions.
Logged

Pages: [1]   Go Up
Jump to: