Ethernet shield refusing to play ball

Hi All,

I’m fairly new to Arduino and programming in general so please bare with me :slight_smile:

I have a project which requires sending some simple command to a device from arduino using Telnet, but I’ve started at the very beginning and am trying to get my shield to work with some of the example sketches. Currently I have tried to make the the WebServer example work to no avail.

I am using a Mega 2560 with Ethernet Shield 2. I’ve used the Webserver example with the only change I’ve made to the sketch is entering the correct Mac Address for my shield;

The sticker reads 90-A2-DA-10-82-FE, so I have modified the sketch to read 0x90, 0xA2, 0xDA, 0x10, 0x82, 0xFE

I then connected the shield to Netgear ProSafe 16 Port Smart Switch and a MBP to the same switch switch with nothing else plugged in. I set my Macs IP to 192.168.1.100 with no router setup and can’t connect to 192.168.1.177 (shield’s address) I simply get “server did not respond” message.

I also tried connecting the arduino to a DHCP router (connected to my home internet) and I still can’t reach the shield. I’ve tried Pinging it from terminal (both direct to mac through switch and via DHCP router) with a constant timeout or “Host is down” message.

Doing some research I found a tiopic where someone had a similar problem and where it was suggested to test the shield with this code:

#include <SPI.h>[color=#222222][/color]
#include <Ethernet.h>[color=#222222][/color]
[color=#222222][/color]
byte mac[] = {  0x00, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };[color=#222222][/color]
[color=#222222][/color]
void setup() {[color=#222222][/color]
  Serial.begin(9600);[color=#222222][/color]
[color=#222222][/color]
  // disable SD SPI[color=#222222][/color]
  pinMode(4,OUTPUT);[color=#222222][/color]
  digitalWrite(4,HIGH);[color=#222222][/color]
[color=#222222][/color]
  Serial.print(F("Starting ethernet..."));[color=#222222][/color]
  if(!Ethernet.begin(mac)) Serial.println(F("failed"));[color=#222222][/color]
  else {[color=#222222][/color]
      Serial.println(Ethernet.localIP());[color=#222222][/color]
      Serial.println(Ethernet.gatewayIP());[color=#222222][/color]
  }[color=#222222][/color]
}[color=#222222][/color]
[color=#222222][/color]
void loop() {[color=#222222][/color]
}

Again no response All i get in the serial monitor is “Starting ethernet…” forever (well at least for the 10minutes or so that I left it alone).

Any ideas? I’m getting quite desperate now as this project needs to be working by middle of next week…

Thanks for any help!
Henri

The Ethernet Shield 2 uses the W5500 Ethernet controller chip instead of the W5100 chip on the Ethernet Shield. The Ethernet library is not compatible with the W5500. If you’re using the arduino.org IDE then you can just change the line:

#include <Ethernet.h>

to:

#include <Ethernet2.h>

If you’re using the arduino.cc (this website) IDE, which I would highly recommend, then you only need to install an Ethernet library that supports the W5500. There are a few choices:

Ethernet2 library - this is the same library included with the arduino.org IDE

EthernetMod W5x00 branch - This supports W5100, W5200, and W5500 without needing any modifications
GitHub - per1234/EthernetMod at W5x00 follow the installation instructions on that page, you don’t need to make any changes to your current sketch.

Wiznet Ethernet Library - GitHub - Wiznet/WIZ_Ethernet_Library: WIZnet Ethernet Library this is already set up to support the W5500 but the installation is slightly complicated so let me know if you want to install that one and need help with installation.

@Pert

Many thanks for you help that has worked instantly!

The only thing I would mention is that I get a "WARNING: Spurious .github folder in 'Ehernet2' Library" message.

Should I be concerned about that?

Thankks again. :slight_smile: :slight_smile: :slight_smile:

The warning is nothing to worry about but it's kind of annoying so if you want to get rid of it do this:

  • File > Examples > Ethernet2 > WebServer
  • Sketch > Show Sketch Folder - This will open the Ethernet2/examples/WebServer folder.
  • Navigate up to the Ethernet2 folder
  • delete the .github folder that is located there(it might be a hidden folder).

After doing that you won't get the warning anymore and it won't cause any problems with the use of the library because that folder only contains internal files for use in administering the GitHub repository.