Thanks for the info, but in my case it did not help. I also tried with an UNO but no joy. I really wanted to use the 5500 but I connected a ENC28J60 module with no issue so maybe I have a dud module?
The library you mentioned was the same one I used and it required no changes as it was already set to use the 5500 via the #defines.
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for (;;)
;
}
I am at work now so I can't check until I get home tonight (Monday already)
Chris
/*
DHCP-based IP printer
This sketch uses the DHCP extensions to the Ethernet library
to get an IP address via DHCP and print the address obtained.
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 12 April 2011
modified 9 Apr 2012
by Tom Igoe
*/
#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[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
};
// 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;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// this check is only needed on the Leonardo:
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for (;;)
;
}
// print your local IP address:
Serial.print("My IP address: ");
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(Ethernet.localIP()[thisByte], DEC);
Serial.print(".");
}
Serial.println();
}
void loop() {
}
Run the test I suggested above. If it shows 192.168.0.2, then the SPI bus and the SPI side of the w5500 is working. If it shows anything else, there is a problem, either hardware or library.
SurferTim:
Run the test I suggested above. If it shows 192.168.0.2, then the SPI bus and the SPI side of the w5500 is working. If it shows anything else, there is a problem, either hardware or library.
I tried tonight and it worked.
I changed the hardware for a Duemilanova and the same W5500 board.
Your code worked and returned 192.168.0.2
I then used the same DHCPAddressPrinter and it worked.
I also tested with WebClient and it worked.
So I am going to try with the UNO hardware and see what it does.
The w5500 will exhibit erratic behavior without a hardware reset of the wiznet chipset before calling Ethernet.begin. I spun out for days on this; sometimes dhcp assigned an ip, most times Ethernet.begin just hung. My dhcp router table had spurious entries with crazy lease times, tried different routers; all unreliable. I put a LED on SS so I could see if they were talking... Then I manually tried a reset to gnd before calling Ethernet.begin and like magic negotiated with dhcp everytime. Moved reset to code and now this is solid as a rock.
I had to change SPI to mode 3 to be able to correctly set the IP address.
#include <SPI.h> #include <Ethernet2.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 2, 80);
extern SPISettings wiznet_SPI_settings;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
The present version of the Standard Ethernet library works!
By default it works with this pin configuration:
This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used to select the Ethernet controller chip, but it must be kept as an output or the SPI interface won't work. RST has to connect to Reset.
But you can change SS pin to 53 by:
// 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