I've tried to init my W5500, but somehow i just get errors. I have successfully communicated with different devices over the SPI bus, but have commented them out for testing the W5500 alone.
Errors i get after start (including Verbose output)
09:47:01.556 -> [ 133][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Dein[ 5682][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x420503d0
09:47:01.556 -> [ 5683][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 47 successfully set to type GPIO (1) with bus 0x30
09:47:01.556 -> [ 5692][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x420503d0
09:47:01.556 -> [ 5703][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 21 successfully set to type GPIO (1) with bus 0x16
09:47:01.595 -> [ 5712][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x420503d0
09:47:01.595 -> [ 5723][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 48 successfully set to type GPIO (1) with bus 0x31
09:47:01.595 -> Resetting W5500...
09:47:02.178 -> [ 6333][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type SPI_MASTER_SCK (34) successfully set to 0x42009d2c
09:47:02.214 -> [ 6334][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type SPI_MASTER_MISO (35) successfully set to 0x42009c54
09:47:02.214 -> [ 6346][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type SPI_MASTER_MOSI (36) successfully set to 0x42009b7c
09:47:02.214 -> [ 6358][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type SPI_MASTER_SS (37) successfully set to 0x42009a68
09:47:02.249 -> [ 6370][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x420503d0
09:47:02.249 -> [ 6381][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 12 successfully set to type GPIO (1) with bus 0xd
09:47:02.249 -> [ 6390][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 12 successfully set to type SPI_MASTER_SCK (34) with bus 0x1
09:47:02.281 -> [ 6401][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x420503d0
09:47:02.281 -> [ 6412][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 13 successfully set to type GPIO (1) with bus 0xe
09:47:02.281 -> [ 6422][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 13 successfully set to type SPI_MASTER_MISO (35) with bus 0x1
09:47:02.319 -> [ 6432][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x420503d0
09:47:02.319 -> [ 6443][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 11 successfully set to type GPIO (1) with bus 0xc
09:47:02.319 -> [ 6453][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 11 successfully set to type SPI_MASTER_MOSI (36) with bus 0x1
09:47:02.319 -> Initializing Ethernet...
09:47:02.319 -> [ 6464][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type ETHERNET_SPI (47) successfully set to 0x4200475c
09:47:02.359 -> [ 6476][V][esp32-hal-periman.c:174] perimanSetPinBusExtraType(): Successfully set extra_type ETH_CS[0] for pin 21
09:47:02.431 -> E (6285) w5500.mac: w5500_reset(305): reset timeout
09:47:02.431 -> E (6285) w5500.mac: emac_w5500_init(823): reset w5500 failed
09:47:02.464 -> E (6286) esp_eth: esp_eth_driver_install(228): init mac failed
09:47:02.464 -> [ 6592][E][ETH.cpp:668] beginSPI(): SPI Ethernet driver install failed: 263
09:47:02.464 -> Ethernet initialization failed!
09:47:02.464 -> =========== After Setup Start ============
09:47:02.464 -> INTERNAL Memory Info:
09:47:02.464 -> ------------------------------------------
09:47:02.464 -> Total Size : 392596 B ( 383.4 KB)
09:47:02.464 -> Free Bytes : 337624 B ( 329.7 KB)
09:47:02.464 -> Allocated Bytes : 49268 B ( 48.1 KB)
09:47:02.496 -> Minimum Free Bytes: 337480 B ( 329.6 KB)
09:47:02.496 -> Largest Free Block: 319476 B ( 312.0 KB)
09:47:02.496 -> ------------------------------------------
09:47:02.496 -> GPIO Info:
09:47:02.496 -> ------------------------------------------
09:47:02.496 -> GPIO : BUS_TYPE[bus/unit][chan]
09:47:02.496 -> --------------------------------------
09:47:02.496 -> 11 : SPI_MASTER_MOSI[0]
09:47:02.496 -> 12 : SPI_MASTER_SCK[0]
09:47:02.496 -> 13 : SPI_MASTER_MISO[0]
09:47:02.496 -> 19 : USB_DM
09:47:02.532 -> 20 : USB_DP
09:47:02.532 -> 21 : ETH_CS[0]
09:47:02.532 -> 43 : UART_TX[0]
09:47:02.532 -> 44 : UART_RX[0]
09:47:02.532 -> 47 : GPIO
09:47:02.532 -> 48 : GPIO
09:47:02.532 -> ============ After Setup End =============
09:47:03.453 -> E (14872) w5500.mac: w5500_send_command(207): send command timeout
09:47:03.453 -> E (14872) w5500.mac: emac_w5500_receive(687): issue RECV command failed
09:47:03.453 -> E (14873) w5500.mac: frame read from module failed
09:47:04.535 -> E (15977) w5500.mac: w5500_send_command(207): send command timeout
09:47:04.577 -> E (15977) w5500.mac: emac_w5500_receive(687): issue RECV command failed
09:47:04.577 -> E (15978) w5500.mac: frame read from module failed
09:47:05.640 -> E (17082) w5500.mac: w5500_send_command(207): send command timeout
09:47:05.680 -> E (17082) w5500.mac: emac_w5500_receive(687): issue RECV command failed
My code for the Init:
#define ETH_PHY_TYPE ETH_PHY_W5500
#define ETH_PHY_ADDR 1
#define ETH_PHY_CS 21
#define ETH_PHY_IRQ 48
#define ETH_PHY_RST 47
#define CLOCK_PIN 12 // SCLK
#define MISO_PIN 13 // MISO
#define MOSI_PIN 11 // MOSI
ETHClass ETH1(1);
void setup() {
Serial.begin(115200);
delay(5000);
pinMode(ETH_PHY_RST, OUTPUT);
pinMode(ETH_PHY_CS, OUTPUT);
pinMode(ETH_PHY_IRQ, INPUT); // IRQ pin is usually input
// Ensure all CS pins are HIGH initially (deselected)
digitalWrite(ETH_PHY_CS, HIGH);
// Reset W5500
Serial.println("Resetting W5500...");
digitalWrite(ETH_PHY_RST, LOW);
delay(100); // Hold reset for 100ms (increase if necessary)
digitalWrite(ETH_PHY_RST, HIGH);
delay(500); // Wait longer for W5500 to stabilize (increase if necessary)
// Initialize SPI
SPI.begin(CLOCK_PIN, MISO_PIN, MOSI_PIN, ETH_PHY_CS);
SPI.setFrequency(500000); // Lower SPI frequency
SPI.setDataMode(SPI_MODE0); // Ensure correct SPI mode
// Initialize Ethernet
Serial.println("Initializing Ethernet...");
if (!ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_CS, ETH_PHY_IRQ, ETH_PHY_RST, SPI)) {
Serial.println("Ethernet initialization failed!");
} else {
Serial.println("Ethernet initialized successfully.");
}
}
Does anyone have a solution for this? What could be the cause?





