Nano + W5100 shield

Hello,

I am trying to send a web request using a W5100 Shield and a Nano board, but I haven’t been able to get the Ethernet to connect to the network.

I have five unopened boards of each. After trying for a long time without success, I tested with new boards in case there was a hardware defect, but the result did not change. There is no issue with the jumper cables either. The connections are as follows:

D13 - 13
D12 - 12
D11 - 11
D10 - 10
GND - GND
5V - 5V

Here is the code I am using:

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,2,2);

void setup() {
  Serial.begin(9600);
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Ethernet.init(10); 
  Serial.println("Starting w5100");
  Ethernet.begin(mac,ip);
  Serial.println(Ethernet.localIP());
}

void loop() {}

It does not properly connect to the network, and I get outputs such as 0.0.0.0 or 255.255.255.0. I also tried connecting directly via ICSP SPI pins, but the issue was not resolved.

A small note:
The following LEDs are lit on the W5100 Shield: PWR, LINK, 100M, FULLD, COLL, L

I would appreciate your help

Have you compared your sketch to examples from the library? There seems to be a difference... Ethernet/examples/WebClient/WebClient.ino at master · arduino-libraries/Ethernet · GitHub

Hey @xfpd, thanks for pointing that out. I just checked the WebClient example, and I noticed it calls Ethernet.begin(mac) without a fixed IP in some cases, relying on DHCP. I wonder if forcing a static IP in the original post might be causing the 0.0.0.0 issue, maybe trying DHCP first could help narrow it down.

@brandonx34 - Are you the same as @haribozowski ?

I do not know. The library allows .begin() to have just the mac, or combinations of these thingies...

void EthernetClass::begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet)

I would start with a library example and "jenga" my way to the answer. I've tried to understand the layers of protocol, but can only repeat them, not understand them, probably out of lack-of-use.

I seem to remember having a similar problem
try a delay between the Ethernet.begin() and printing the localIP

  Ethernet.begin(mac,ip);
 delay(1000);
  Serial.println(Ethernet.localIP());

Hi, I tried it and it gave me that output:

Initialize Ethernet with DHCP:
Failed to configure Ethernet using DHCP
Ethernet shield was not found. Sorry, can't run without hardware. :(

Also I just checked and saw my card is 511 ohm. Could that be the problem?