Trouble getting W5500 ethernet (SPI) to run on MEGA2560 and ESP8266

I can get the W5500 ethernet module to run the IP address print example on a regular Arduino Uno. But I haven't been able to get the same W5500 and DHCP address sketch to work with the ArduinoMEGA2560, nor with the ESP8266.

On the Arduino MEGA, the SPI pins are:
50 = MISO
51 = MOSI
52 = SCK
53 = SS

On the ESP8266, I'm using:

I think I have the pins correct, checked several times. On the MEGA, I just get a "Failed to configure Ethernet using DHCP" on serial monitor. On the ESP8266, I seem to be getting memory dumps when I serial monitor.

I am using the Ethernet2 library that supports the W5500 (not the old W5100 ethernet library).

I don't see a lot of people using this ethernet module on MEGA and ESP8266, so there's not a lot to go by. I haven't found any references to anyone successfully getting this to work.

I've also tried replacing this Ethernet library from Wiznet which specifically states it supports ESP8266, but still nothing.

Any ideas?

I don't see a lot of people using this ethernet module on MEGA and ESP8266, so there's not a lot to go by.

What about the official reference page for the Ethernet / Ethernet2 libraries (Arduino - Ethernet):

Arduino communicates with the shield using the SPI bus. 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 W5100, but it must be kept as an output or the SPI interface won't work.

For using the ESP8266 with the Wiznet library your connections are correct.

Thanks for the note to check the official reference page. Putting it on the correct pin made the MEGA work.

However, still haven't made progress with the ESP8266 on the W5500 ethernet module.

Glad to hear the Mega is working!

I don't have any experience with using the Wiznet library with ESP8266. I just looked at the source code for the library and I think that actually you should use GPIO10 for CS. The code also uses the SS macro, which initially threw me off but I think that is just making sure that the microcontroller doesn't go into slave mode.

Also, keep in mind that on some ESP8266 boards (such as WeMos D1) the pin numbers printed on the PCB do not match the ESP8266 GPIO numbers. The numbers on the PCB are the Dn pin numbers, which are mapped to arbitrary GPIO numbers. You can find the pin mappings in the variant file for your board.

I got it working on Mega with pin 10 is used as SS.