Go Down

Topic: Ethernet module W5500 from AliExpress - how to use? (Read 2656 times) previous topic - next topic

iisfaq

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

SurferTim

#1
Jul 24, 2016, 04:00 am Last Edit: Jul 24, 2016, 04:03 am by 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.
https://github.com/Wiznet/WIZ_Ethernet_Library

Koepel

How to use ? That's easy : Buy the Adafruit W5500 shield and attach it to the Mega board.
https://www.adafruit.com/products/2971

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

iisfaq

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.
https://github.com/Wiznet/WIZ_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

SurferTim

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?
Code: [Select]
#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() {
}

iisfaq

Hi

I have not used the same code as you listed.

I was using the DHCPAddressPrinter example.

Basically it is this code.....

Code: [Select]

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


Code: [Select]

/*
  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() {

}

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.

iisfaq


iisfaq

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

iisfaq

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

SurferTim

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

iisfaq

I don't know, but as long as it is working, that is a good thing.
Thanks again for your help.

Chris

mbence

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!

surfride

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
https://forum.wiznet.io/t/topic/1224/2

mbence

Hi surfride, thanks for the reply!

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

Code: [Select]

#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:
Quote
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.  :smiley-confuse:

Go Up