Ethernet module W5500 from AliExpress - how to use?

I have purchased a W5500 Module from AliExpress that I want to use on an Arduino Mega 2560;

AliExpress W5500

It has the following pins

I do not know what the INT pin is or how to connect it or if it needs to be connected.

I have currently the 3.3, INT, RST and NC pins not connected to anything.

Using the WizNet 5500 library or the Adafruit Ethernet 2 library I can not get it to work.

Has anyone seen any references to this module online where it is connected?

The samples all seem to be fore connecting on a UNO or something similar since the example states

  • Ethernet shield attached to pins 10, 11, 12, 13

Since I am on a MEGA I am using SPI on 50,51,52 and 53

Cheers

MISO -> D50
MOSI -> D51
SCLK -> D52
SCS -> D10
RST -> RESET

INT N.C.

edit: You'll need to use the Wiznet library for the w5500.

How to use ? That's easy : Buy the Adafruit W5500 shield and attach it to the Mega board.

You know that you should have done that, when you need a SD socket.

SurferTim:
MISO -> D50
MOSI -> D51
SCLK -> D52
SCS -> D10
RST -> RESET

INT N.C.

edit: You'll need to use the Wiznet library for the w5500.
GitHub - Wiznet/WIZ_Ethernet_Library: WIZnet Ethernet Library

Hi

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.

Chris

Are you powering it with 5 volts on the 5v pin?

What have you tried? Have you tried this test? Does it show 192.168.0.2 as the IP?

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

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

void setup() {
  Serial.begin(9600);

  // disable SD card if one in the slot
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Serial.println("Starting ethernet");
  Ethernet.begin(mac,ip);

  Serial.println(Ethernet.localIP());
}

void loop() {
}

Hi

I have not used the same code as you listed.

I was using the DHCPAddressPrinter example.

Basically it is this code.....

 // 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.

Thanks will do.

Chris

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.

Thanks for your support...

Chris

I can't understand it the UNO worked, and the ATMega2560 works now as well.

I can not have stuffed up the pins on 3 devices yesterday.

I just do not know what is going on.

Could the library have been cached after I replaced the files for the W5500?

Chris

I don't know, but as long as it is working, that is a good thing.

SurferTim:
I don't know, but as long as it is working, that is a good thing.

Thanks again for your help.

Chris

Hi Guys,

I have the same module, but I'm unable to get it to work. Trying on an UNO R3.

No matter which library I use, I'm unable to set the IP address.
If I try to use DHCP, it stops responding alltogether.

Is there a working lib for this module? Or any advice, how to use it?

Thanks!

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.

reference to WizNet

Hi surfride, thanks for the reply!

I connected the RST to pin 9, and tried this code (with the Adafruit library):

#include <SPI.h>
#include <Ethernet2.h>

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

EthernetServer server(80);

void setup() {
  Serial.begin(9600);
 
  pinMode(9, OUTPUT);  
  digitalWrite(9, LOW);
  delayMicroseconds(500);
  digitalWrite(9, HIGH);
  delayMicroseconds(1000);

  Ethernet.begin(mac, ip);
  
  server.begin();
  Serial.print("Server is at ");
  Serial.println(Ethernet.localIP());
}


void loop() {
}

With this I get the very same results, as without resetting:

Server is at 192.80.0.44

If I leave pin 9 on LOW, localIP() reports 0.0.0.0
If I don't set any IP, DHCP just freezes the board.

The strange thing is, that I can set the IP to 10.0.0.10 and with that I can even ping the board, but nothing else would function.

If I try to set an IP with the second byte above 127, I always get some completely different IP from Ethernet.localIP()

I'm about to give up on this one. :confused:

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);

SPISettings settingsA(8000000, MSBFIRST, SPI_MODE3);
wiznet_SPI_settings = settingsA;

// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}

void loop() {
}

1 Like

Thanks pattheaux, I will give it a try with mode 3!

SurferTim:
MISO -> D50
MOSI -> D51
SCLK -> D52
SCS -> D10
RST -> RESET

INT N.C.

edit: You'll need to use the Wiznet library for the w5500.
GitHub - Wiznet/WIZ_Ethernet_Library: WIZnet Ethernet Library

I have the same W5500 and i was using D53 but the working one is D10! the SCS -> D10

Thanks SurferTim

On my Mega if i test my pins i get:

MISO : 50
MOSI : 51
SCK : 52
SS : 53

void setup() {
  Serial.begin(9600);

  Serial.print("MISO : ");
  Serial.println(PIN_SPI_MISO);
  Serial.print("MOSI : ");
  Serial.println(PIN_SPI_MOSI);
  Serial.print("SCK : ");
  Serial.println(PIN_SPI_SCK);
  Serial.print("SS : ");
  Serial.println(PIN_SPI_SS);
 
}

void loop() {
}

The problem is solved
Try to shorten the connecting cables from the arduino to the w5500 chip.
The problem comes from embarrassment (noise)!

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.

From https://www.arduino.cc/en/Reference/Ethernet

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