Issue: Compatibility of Arduino Zero with W5500 Ethernet Module Using Specific Pin Mapping
Problem Description
I am trying to migrate a project from an Arduino Due to an Arduino Zero. The project uses a W5500 Ethernet module and works perfectly on the Due. However, after switching to the Zero, I am unable to achieve a successful connection. To be more specific: DFRobots PoE Ethernet Shield
Both the Arduino Due and Zero operate at 3.3V logic levels, and the W5500 module is compatible with 3.3V logic. Despite this, the project does not function as expected when using the Zero.
Hardware Setup
- Microcontroller: Arduino Zero (previously Arduino Due)
- Ethernet Module: W5500
- Pin Connections:
SS(Chip Select): Pin10RST(Reset): Pin11SPIBUG: Pin4
- Power Supply:
- The W5500 module is powered via the 3.3V pin of the Arduino board or using PoE.
- The Arduino Zero is powered via USB or using the shield via PoE.
Sketch Code
Below is a summary of the relevant sketch code:
#include <SPI.h>
#include <Ethernet2.h>
/**
* Declare some IO variables for SPI configurations
* and W5500 reset settings.
* Also define CARD reader IO to avoid SPI disruptance!
*/
#define SS 10U //W5500 CS
#define RST 11U //W5500 RST
#define SPIBUG 4U
// Define the debug state. If true, enable specific debug details.
bool debug = true;
/**
* Declare some variables required for ethernet.
* Enter a MAC address and IP address for your controller below.
* The IP address will be dependent on your local network.
* Local port to listen for UDP packets.
*/
byte mac[] = {
0xfc, 0x8d, 0x93, 0x59, 0xc0, 0x81
};
IPAddress ip(192, 168, 137, 151);
IPAddress gw(192, 168, 137, 1);
IPAddress subnet(255, 255, 255, 0);
EthernetClient client;
EthernetServer server(80);
void setup() {
pinMode(SPIBUG, OUTPUT);
digitalWrite(SPIBUG, HIGH);
digitalWrite(SS, LOW);
digitalWrite(RST, HIGH); //Reset this (WIZNET W5500) module
delay(200);
digitalWrite(RST, LOW);
delay(200);
digitalWrite(RST, HIGH);
delay(200);
Serial.begin(115200);
while (!Serial) {
;
}
Ethernet.begin(mac, ip, gw, gw, subnet);
server.begin();
if (debug) printEthernetSettings();
}
void loop() {
EthernetClient client = server.available();
if (client) {
if (debug) Serial.println("Client connected");
while (client.connected()) {
while (client.available()) {
char c = client.read();
Serial.print(c);
}
}
}
}
void printEthernetSettings() {
Serial.println();
Serial.println("---CURRENT NETWORK PROPERTIES---");
Serial.println(Ethernet.localIP());
Serial.println(Ethernet.gatewayIP());
Serial.println(Ethernet.subnetMask());
Serial.println(Ethernet.dnsServerIP());
Serial.println("------------------------------");
Serial.println();
}
Behavior Observed
On the Arduino Due: The code works as expected. The Ethernet module initializes and connects to the network.
On the Arduino Zero: The Ethernet module does not initialize, and the connection fails. In fact, it does completely nothing
Steps Taken to Troubleshoot
- Verified physical connections and ensured proper pin alignment for SS, RST, and SPIBUG.
- Double-checked the W5500 module's power supply to confirm it receives 3.3V.
- Confirmed the sketch compiles and uploads successfully to the Arduino Zero.
- Tested basic SPI communication using the Arduino Zero, which works fine with other SPI ## peripherals (variant.cpp files for both boards).
- Checked for library compatibility:
- Using the standard Ethernet library included with the Arduino IDE.
- Updated all libraries to the latest versions.
- Measured voltage levels on the SS, RST, and SPIBUG pins during initialization:
- Observed correct levels (LOW/HIGH) on the Due.
- Observed correct levels on the Zero as well.
Questions
- Is there any known issue with using the W5500 Ethernet module on the Arduino Zero?
- Are there differences in SPI behavior between the Arduino Due and Zero that might require modifying the sketch?
- Could there be a hardware-level incompatibility despite both boards using 3.3V logic?
- Is there a specific initialization step or configuration required when using the W5500 with the Arduino Zero?
Additional Information
Arduino IDE Version: 2.3.4 (also tested with 1.8.x)
Ethernet Library Version: Latest available in the Library Manager (Ethernet2 1.0.4), also tried Ethernet, WIZnet official and Ethernet3
W5500 Module: Works perfectly with the Arduino Due and other 3.3V microcontrollers
Arduino Zero: Communicates with other SPI peripherals without issue
Any help or insights into this problem would be greatly appreciated!