Arduino with MKR ETH shield Hardware failure

Hello Guys,

today I bought the Arduino MKR ETH Shield and tried to connect it with my laptop via ethernet cable. I tried to get the example scripts working but the Serial.print shows me that there is no hardware connected but in fact it is. The led on the ethernet shield is blinking. I searched through the internet but didn t found a solution. I tried one script and it showed me an ip adress of 0.0.0.0 somebody on the internet said that means my hardware is broken but I’m not sure because I don’t want it to be real.

I then tried other script like the “webserver/client” example and there it showed me that the hardware is missing.

I guess I haven t plugged in the ethernet shield right because i couldn t found a good documentation.
Does somebody knows what I can do make the shield get a mac adress and maybe has a documentation to show me which pins of the MKR SHield I have to plug in which pins of the Arduino Mega 2560?

Thank you very much

edit: The Code I tried:

/*
  Web client

 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen

 */

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128);  // numeric IP for Google (no DNS)
char server[] = "www.google.com";    // name address for Google (using DNS)

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
IPAddress myDns(192, 168, 0, 1);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

// Variables to measure the speed
unsigned long beginMicros, endMicros;
unsigned long byteCount = 0;
bool printWebData = true;  // set to false for better speed measurement

void setup() {
  // You can use Ethernet.init(pin) to configure the CS pin
  //Ethernet.init(10);  // Most Arduino shields
  Ethernet.init(5);   // MKR ETH shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit Featherwing Ethernet

  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
      while (true) {
        delay(1); // do nothing, no point running without Ethernet hardware
      }
    }
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.print("connecting to ");
  Serial.print(server);
  Serial.println("...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.print("connected to ");
    Serial.println(client.remoteIP());
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.1");
    client.println("Host: www.google.com");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
  beginMicros = micros();
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  int len = client.available();
  if (len > 0) {
    byte buffer[80];
    if (len > 80) len = 80;
    client.read(buffer, len);
    if (printWebData) {
      Serial.write(buffer, len); // show in the serial monitor (slows some boards)
    }
    byteCount = byteCount + len;
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    endMicros = micros();
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    Serial.print("Received ");
    Serial.print(byteCount);
    Serial.print(" bytes in ");
    float seconds = (float)(endMicros - beginMicros) / 1000000.0;
    Serial.print(seconds, 4);
    float rate = (float)byteCount / seconds / 1000.0;
    Serial.print(", rate = ");
    Serial.print(rate);
    Serial.print(" kbytes/second");
    Serial.println();

    // do nothing forevermore:
    while (true) {
      delay(1);
    }
  }
}[code]

Post the code you used for testing! (don’t forget to use code tags, that’s the </> button in the editor)

today I bought the Arduino MKR ETH Shield and tried to connect it with my laptop via ethernet cable.

Is your Laptop auto-MDI/MDIX enabled? Otherwise you need to have a switch in between.

What model of Arduino are you using?

Does somebody knows what I can do make the shield get a mac adress and maybe has a documentation to show me which pins of the MKR SHield I have to plug in which pins of the Arduino Mega 2560?

You must not connect that shield directly to a Mega2560 as it has only 3V3 logic on board and is not prepared to be connected to a 5V Arduino.

Thank you for the reply!

The code I used:

/*
  Web client

 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen

 */

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128);  // numeric IP for Google (no DNS)
char server[] = "www.google.com";    // name address for Google (using DNS)

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
IPAddress myDns(192, 168, 0, 1);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

// Variables to measure the speed
unsigned long beginMicros, endMicros;
unsigned long byteCount = 0;
bool printWebData = true;  // set to false for better speed measurement

void setup() {
  // You can use Ethernet.init(pin) to configure the CS pin
  //Ethernet.init(10);  // Most Arduino shields
  Ethernet.init(5);   // MKR ETH shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit Featherwing Ethernet

  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
      while (true) {
        delay(1); // do nothing, no point running without Ethernet hardware
      }
    }
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.print("connecting to ");
  Serial.print(server);
  Serial.println("...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.print("connected to ");
    Serial.println(client.remoteIP());
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.1");
    client.println("Host: www.google.com");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
  beginMicros = micros();
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  int len = client.available();
  if (len > 0) {
    byte buffer[80];
    if (len > 80) len = 80;
    client.read(buffer, len);
    if (printWebData) {
      Serial.write(buffer, len); // show in the serial monitor (slows some boards)
    }
    byteCount = byteCount + len;
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    endMicros = micros();
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    Serial.print("Received ");
    Serial.print(byteCount);
    Serial.print(" bytes in ");
    float seconds = (float)(endMicros - beginMicros) / 1000000.0;
    Serial.print(seconds, 4);
    float rate = (float)byteCount / seconds / 1000.0;
    Serial.print(", rate = ");
    Serial.print(rate);
    Serial.print(" kbytes/second");
    Serial.println();

    // do nothing forevermore:
    while (true) {
      delay(1);
    }
  }
}

I dont think that I have enables that I once connected my raspberry pi to the laptop and it worked so I thought it would be the same with the arduino :smiley:

How do I connect the Arduino to the shield ? I think I also mixed up the SPI Pins because I still can find a documentation about the shield:

https://store.arduino.cc/arduino-mkr-eth-shield

This is the shield

Why do you bought a MKR shield for the Mega? You are lucky that the shield works with 5 V. The SPI pins of Mega are 50 MISO, 51 MOSI, 52 CLK and use 53 for CS

I thought that would be a good idea... Can you explain me why that isnt the case ?

And do I have to plug the MSIO MOSI and the SCK Pin in the 50-52 pins and the eth CS in the 53 Pin ?

edit:

I tried the code with the pins you told me too but it still didn t work ...

benipro: I thought that would be a good idea... Can you explain me why that isnt the case ?

And do I have to plug the MSIO MOSI and the SCK Pin in the 50-52 pins and the eth CS in the 53 Pin ?

edit:

I tried the code with the pins you told me too but it still didn t work ...

the MKR shield is for MKR boards. the MKR boards work with 3.3 V. you are lucky that they decided to use 5 V and convert it back 3.3 V.

if you want Ethernet for Mega, buy the Ethernet shield, or if you don't want a shield, then buy a small Wiznet module.

the MKR ETH shield has the SPI pins on the location of SPI pins of the MKR boards.

Mhmmm... That make sense ... Unluckily I already bought the Shield... Is it possible to make the ethernet connection work with the mega or should i buy another one ?

And thank you very much for the replys :)

benipro: Mhmmm... That make sense ... Unluckily I already bought the Shield... Is it possible to make the ethernet connection work with the mega or should i buy another one ?

And thank you very much for the replys :)

it is possible. wire the SPI pins, 5 V and ground together and it will work

Ok thank you thats a relief :D

Next time I will try to get more information about the Shield before I buy it. I just saw on the website that it was compatibel to the mega and because of that I bought it :D

benipro: Ok thank you thats a relief :D

Next time I will try to get more information about the Shield before I buy it. I just saw on the website that it was compatibel to the mega and because of that I bought it :D

I wonder about the compatibility. the Wiznet chip is 5 V tolerant, but In the schema I don't see a logic level conversion for the SD card.

Its fine I think I will not use the SD Card ^^

I reported it and they corrected the shop page TECH SPECS of MKR ETH

https://store.arduino.cc/arduino-mkr-eth-shield