UNO R3 + Eth Shield + SD Card = Problem after uploading [SOLVED!!]

If I attached my UNO + Ethernet Shield, then I upload webserver sketch, it is successfully uploaded, then I open serial monitor then it displays server is at 192.168.1.177
I have no problem with above.

But if I connect my UNO + Ethernet Shield by wiring through ICSP header , then I upload webserver sketch, it is successfully uploaded, then I open serial monitor then it display server is at 255.255.255.255

Why can it be different?
Sure it becomes problem for me because I can not access through 255.255.255.255
Any solution?

Thank you so much.

Here the WebServer sketch:

/*
  Web Server
 
 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield.
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)
 
 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe
 
 */

#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[] = {
  0x90, 0xA2, 0xDA, 0x00, 0xFE, 0xAC };
IPAddress 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):
EthernetServer server(80);

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
  


  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // 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("Connnection: close");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
                    // add a meta refresh tag, so the browser pulls again every 5 seconds:
          client.println("<meta http-equiv=\"refresh\" content=\"5\">");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            server.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("
");      
          }
          client.println("</html>");
          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();
    Serial.println("client disonnected");
  }
}

I have solved this.
I forget to wire pin 10,11,12,and 13 from Eth Shield to UNO.
Sorry.

But I face problem if I replace my UNO with Mega 2560 R2.
the problem is the serial monitor display: server is at 255.255.255.255

I connect the ICSP in the same position with UNO by wiring
Then I wire from Mega to Eth Shield: pin 53 to pin 10, pin 52 to pin 13, pin 51 to pin 12, pin 50 to pin 11
any wrong with my wiring?

any help please?

Could anyone ever face this problem before? :fearful:

I have solved this.
I forget to wire pin 10,11,12,and 13 from Eth Shield to UNO.

If the ethernet shield was wired to the Arduino ICSP, then I think all you needed to connect was digital pin 10. Digital pins 11-13 are not connected to anything on the newer ethernet shields.

Then I wire from Mega to Eth Shield: pin 53 to pin 10, pin 52 to pin 13, pin 51 to pin 12, pin 50 to pin 11
any wrong with my wiring?

Connect digital pin 10 to digital pin 10, not 53.
I think you have the MISO and MOSI pins reversed also. Pin 11 to 51 and pin 12 to 50. But this may not work if the ethernet shield is a newer model. Best to connect ICSP to ICSP.

edit: Also connect digital pin 4 to digital pin 4 on both. That is the SS for the SD card.
Both the Uno and the Mega should wire the same. ICSP to ICSP, 10 to 10, and 4 to 4.

SurferTim:

I have solved this.
I forget to wire pin 10,11,12,and 13 from Eth Shield to UNO.

If the ethernet shield was wired to the Arduino ICSP, then I think all you needed to connect was digital pin 10. Digital pins 11-13 are not connected to anything on the newer ethernet shields.

Oh, so digital pins 11-13 can be use for other purpose, as output like that?

Then I wire from Mega to Eth Shield: pin 53 to pin 10, pin 52 to pin 13, pin 51 to pin 12, pin 50 to pin 11
any wrong with my wiring?

Connect digital pin 10 to digital pin 10, not 53.
I think you have the MISO and MOSI pins reversed also. Pin 11 to 51 and pin 12 to 50. But this may not work if the ethernet shield is a newer model. Best to connect ICSP to ICSP.

edit: Also connect digital pin 4 to digital pin 4 on both. That is the SS for the SD card.
Both the Uno and the Mega should wire the same. ICSP to ICSP, 10 to 10, and 4 to 4.

Oh yeah, I mistype for the MOSI and MISO.
Now I connect only the ICSP and the pin 10 to pin 10, then IT WORKS!!!!!!!!!!!
YOU ARE SO GENIOUS!!!
Now it shows: server is at 192.168.1.177

PROBLEM SOLVED!
a lot of thanks for johnwasser and SurferTim :smiley: