ESP32 + W5500: network.LAN() fails without an interrupt pin
Port, board and/or hardware
AtomS3 Lite, Atomic PoE Base (W5500)
MicroPython version
MicroPython v1.24.1 on 2024-11-29; M5Stack AtomS3 Lite with ESP32S3
Reproduction
- Connect an AtomS3 Lite to an Atomic PoE Base.
- Run the following script:
import machine
import network
spi = machine.SPI(1, sck=machine.Pin(5), mosi=machine.Pin(8), miso=machine.Pin(7))
lan = network.LAN(phy_type=network.PHY_W5500, spi=spi, phy_addr=1, cs=machine.Pin(6))
Expected behaviour
network.LAN() succeeds.
Observed behaviour
network.LAN() fails.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: esp_eth_driver_install failed with invalid argument
Additional Information
Some W5500 modules don’t include an interrupt pin, so ESP-IDF provides a polling mode (commit).
To enable polling, int_gpio_num must be set to -1 and poll_period_ms must be greater than 0.
However, esp_eth_driver_install() fails because poll_period_ms is 0 in ETH_W5500_DEFAULT_CONFIG.
To fix this, we either need to set poll_period_ms to greater than 0 in network_lan.c or change its default in ESP-IDF.
Code of Conduct
Yes, I agree
Reinitializing network.LAN with W5500 Causes Connection Loss Until Hard Reset
Port, board and/or hardware
esp32 port
MicroPython version
All Versions
MicroPython v1.25.0-preview.283.g11c9656fa on 2025-02-10; Generic ESP32 module with SPIRAM with ESP32
Reproduction
Issue Description:
When running the following MicroPython script on an ESP32 with a W5500 Ethernet module, the connection works correctly on the first run after powering up the board. However, if the script is executed again without a full power cycle or machine.reset(), the device loses network connectivity (cannot be pinged).
- Power on the ESP32 with the W5500 module connected.
- Run the following MicroPython script:
import network
import time
from machine import Pin, SPI, reset
rst = Pin(15, Pin.OUT)
rst.value(0)
time.sleep(0.1)
rst.value(1)
time.sleep(0.5)
spi_nic = SPI(1, baudrate=26000000, sck=Pin(18), mosi=Pin(21), miso=Pin(19))
nic = network.LAN(phy_type=network.PHY_W5500, spi=spi_nic, phy_addr=1, cs=Pin(5), int=Pin(4))
config = ('192.168.1.120', '255.255.255.0', '192.168.1.1', '8.8.8.8')
nic.ifconfig(config)
nic.config(mac=b'\x02\xAB\xCD\xEF\x01\x02')
nic.active(True)
time.sleep(0.5)
while not nic.isconnected():
print(".", end="")
time.sleep(0.25)
print("\r\nip=", nic.ifconfig())
- Confirm that the device is reachable via ping.
- Run the script again without resetting the board.
- Observe that the device no longer responds to ping, and the network connection is lost.
- If machine.reset() is executed before re-running the script, the connection works fine again.
Expected behaviour
Re-running the script should properly reset the W5500 and establish a new network connection without requiring a full board reset.
Observed behaviour
After executing the script multiple times without a full reset, the ESP32 loses network connectivity. The W5500 module does not seem to reinitialize correctly unless a full machine.reset() is performed.
Additional Information
Workarounds Tried:
Explicitly deactivating nic before reinitializing:
try:
nic.active(False)
del nic
except:
pass
→ Did not solve the issue.
Resetting the W5500 before reinitialization using rst pin:
→ No effect; issue persists.
Performing machine.reset() before re-running the script:
→ Works, but not an ideal solution
Code of Conduct
Yes, I agree