Go Down

Topic: Ethernet shield, can't ping (Read 8081 times) previous topic - next topic

kivig

Hi,
after googling and reading quite a few threads about ethernet shield troubleshooting I ended up with no result. So:
got the ethernet shield on my Arduino Uno.
Loaded default server sketch.
- When connecting to my switch I get steady green led and occasionally blinking orange on connector. Orange led blinks when I try to ping but ping says "Destination host unreachable".
- When connecting through cross cable to my PC (Vista) I get steady green led and a lots of orange blinks initially, but it goes off later. Orange led stays off when I try to ping. Ping says: ping transmit failed, error code 1231. (my ipV6 is disabled in network settings, firewall disabled)

In both cases nothing comes up from shield ip in browser. I used default shield ip and MAC (I did make sure that my pc has different last number of ip)
I tried powering from usb and 6V power adaptor.

As my experience with networking is limited to switch, router and a couple of computers and I didn't use full size shields before (only RF transmitters, servos, relays etc.) I have no Idea what could be wrong.
Should I return the shield?
Thanks!

zoomkat

You probably need to post the type of ethernet shield you are using and your arduino code.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

kivig

Arduino Ethernet Shield V1.1
ENC28J60 controller
port label: HanRun HR911102A 09/44

Default Arduino 0021 example sketch.
Have tried changing IP/MAC.
Quote

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1, 177 };

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(80);

void setup()
{
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  // listen for incoming clients
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(analogRead(analogChannel));
            client.println("<br />");
          }
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
  }
}

zoomkat

Quote
Arduino Ethernet Shield V1.1
ENC28J60 controller
port label: HanRun HR911102A 09/44


Are you using the appropriate librarys and code with the ENC28J60 based ethernet shield? The ENC28J60 is significantly different and more complex to program than the W5100 based shield.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

kivig


Quote
Arduino Ethernet Shield V1.1
ENC28J60 controller
port label: HanRun HR911102A 09/44


Are you using the appropriate librarys and code with the ENC28J60 based ethernet shield? The ENC28J60 is significantly different and more complex to program than the W5100 based shield.

So that's the problem!
I thought they're compatible. Thanks, saved a lot of time!

kivig

#5
Apr 18, 2011, 11:19 am Last Edit: Apr 18, 2011, 11:21 am by kivig Reason: 1
Up and running.
Thanks again!

For someone as clumsy as me :)
the library for ENC28J60 based shields:
http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=4&zenid=4f8763dd32227d54ee11ac472d5c09a4

Grag38

Dont forget to set an static ip address on your pc, usually it's set as DHCP address that will not works in thta case.

So from set an adress like 192.168.1.1 to ethernet adapter on the pc.

Go Up