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
LAN8720 ESP32 throwing error on new firmware
I have made a custom board and I referred to the documentation and tried to connect the LAN8720 with ESP32 and it gives an error as extra keywords given. Also, I feel the documentation of LAN network is incomplete.
It mentions phy_clock but on adding this key it provides error. The firmware used is v.19.1
import network import machine import time from machine import Pin print("Initializing LAN") l = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), phy_type = network.PHY_LAN8720,phy_clock = False, phy_addr=1) P32 = Pin(32, Pin.OUT) P32(0) time.sleep_ms(500) P32(1) Initializing LAN Traceback (most recent call last): File "<stdin>", line 6, in <module> TypeError: extra keyword arguments given
If i remove the phy_clock key, I get the following error:
import network import machine import time from machine import Pin print("Initializing LAN") l = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), phy_type = network.PHY_LAN8720, phy_addr=1) P32 = Pin(32, Pin.OUT) P32(0) time.sleep_ms(500) P32(1) Initializing LAN E (210) emac_esp32: emac_esp32_init(308): reset timeout E (210) esp_eth: esp_eth_driver_install(198): init mac failed Traceback (most recent call last): File "<stdin>", line 6, in <module> OSError: esp_eth_driver_install failed
If I use an older firmware(v.13) version it detects lan but doesn't provide any IP Address. The older version had no field named phy_clock.