← index #16561PR #10420
Related · high · value 0.539
QUERY · ISSUE

ESP32 + W5500: network.LAN() fails without an interrupt pin

openby YamadaKyoheiopened 2025-01-10updated 2025-11-17
bugport-esp32

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

  1. Connect an AtomS3 Lite to an Atomic PoE Base.
  2. 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

CANDIDATE · PULL REQUEST

ports/esp32: Add support for SPI-based ethernet chips

mergedby damzopened 2023-01-06updated 2023-06-13
port-esp32

What?

Add support for various SPI-based ethernet chips (W5500, KSZ8851SNL, DM9051) to the ESP32 port.

The impetus for this was to support the POE Featherwing, which is based on the Wiznet W5500 chip.

How?

Leverage the existing support in ESP-IDF for these chips, and the existing support for network.LAN in the ESP32 port.

In particular, this doesn't leverage the wiznet5k support that is used on the rp2 and stm32 ports.

A note on testing

I tested this on the POE Featherwing (with the SJIRQ solder jumper bridged) and a ESP32-S3 feather.

While I do not have access to hardware using the other chips, the set up method for them comes from the ethernet/basic example from ESP-IDF 4.4, so I am relatively confident that it is correct.

A note about the interrupt pin

The W5500 implementation within ESP-IDF relies on hardware interrupt, and requires the interrupt pin from the W5500 to be wired to a GPIO. This is not the case by default on the Adafruit Ethernet FeatherWing, which makes it not directly compatible with this implementation.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied