I have the following problem. I have got a new MEGA 2560 Rev.3 Board with a new Ethernet Shield w5100 with ICSP Interface. I stacked them together and I can access the SD-Card on the Ethernet Shield, but I can not set an IP address (not manually and not via DHCP). I always get 0.0.0.0 when I call Ethernet.localIP(); In case of setting IP via DHCP (only MAC address submitted to DHCP Server) the sketch hangs up forever. In case of manually configure the IP, I can ping the board correctly, if i insert a SD card. How can the board do that, when Ethernet.localIP() ever responses 0.0.0.0? Sounds really strange to me.
So my questions are:
Is there someone out there, who has the same problem as i have and did you solve it?
I think, i don´t need any jumper cables on that board to work with Ethernet. It that correct?
Maybe i need a specific Ethernet library to work with the new Ethernet Shield? I don´t think so, but maybe there is one.
Here is a short breakout of my sketch:
#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192,168,73,230);
const byte EthernetPin = 10;
const byte SDPin = 4;
EthernetServer server(80);
Sd2Card card;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
pinMode(53, OUTPUT);
delay(1000);
Serial.print("Initializing SD card...");
if (!card.init(SPI_HALF_SPEED, SDPin)) {
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card is inserted?");
Serial.println("* Is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
//return;
} else {
Serial.println("Wiring is correct and a card is present.");
}
Serial.println("initialization done.");
pinMode(SDPin, OUTPUT);
digitalWrite(SDPin, HIGH); //Disable SD card
pinMode(EthernetPin, OUTPUT);
digitalWrite(EthernetPin, LOW); //Enable Ethernet
delay(1000);
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop() {
}
And here is my output from serial monitor, if no SD card inserted:
Initializing SD card...initialization failed. Things to check:
- is a card is inserted?
- Is your wiring correct?
- did you change the chipSelect pin to match your shield or module?
initialization done.
server is at 0.0.0.0
ping 192.168.73.230
Ping wird ausgeführt für 192.168.73.230 mit 32 Bytes Daten:
Antwort von 192.168.73.230: Bytes=32 Zeit<1ms TTL=128
Antwort von 192.168.73.230: Bytes=32 Zeit<1ms TTL=128
...
And here the output from serial monitor with SD card inserted:
Initializing SD card...Wiring is correct and a card is present.
initialization done.
server is at 0.0.0.0
ping 192.168.73.230
Ping wird ausgeführt für 192.168.73.230 mit 32 Bytes Daten:
Antwort von 192.168.73.20: Zielhost nicht erreichbar. ( 192.168.73.20: Destination host unreachable.)
Antwort von 192.168.73.20: Zielhost nicht erreichbar.
...
Any suggestions? Oh another thing i did, i replaced the ethernet shield with a new one without any changes of behavior.
I appreciate your help!
Thx