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
esp32/network_lan: Add clock configuration.
Allow support for Olimex esp32-poe board family.
Testes with code snippet on esp32-poe-iso:
import network
import machine
lan = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), power=machine.Pin(12), phy_type = network.PHY_LAN8720, phy_addr=0, clock_out = machine.Pin(17))
lan.active(1)
lan.ifconfig()
Solves issue https://github.com/micropython/micropython/issues/9100
Signed-off-by: Bartek bartekwolowiec@gmail.com