← index #6503PR #4515
Related · high · value 2.111
QUERY · ISSUE

ESP32 LAN8720 MDC/MDIO control only

openby emardopened 2020-10-01updated 2024-10-01
port-esp32needs-info

HI

Are ESP32 libraries that control ETH RMII PHY available
for direct use, I need to control LAN8720 MD interface
with 2 pins called MDC/MDIO, and I'd like some suggestion
how to do it from micropython.

I'd like to control only the PHY using this 2 pins and
II don't want to initialize ESP32 complete wired ethernet
with all of RMII pins, because those RMII pins are not
connected to ESP32.

CANDIDATE · PULL REQUEST

Add support clock mode for ESP32 ethernet module

closedby petrkropened 2019-02-17updated 2019-02-21
port-esp32

I've added optional parameter support for network.LAN clock_mode and implemented new enum string for network module class to support Clock mode for ESP32.

Can be used for some cases when especially LAN8720 modules uses clock source from ESP's pin GPIO17.

usage:

import machine
import network

lan = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), power=None, phy_type = network.PHY_LAN8720, phy_addr=1, clock_mode=network.ETH_CLOCK_GPIO17_OUT)
lan.active(1)

new enum at network module:

>>> for i in dir(network): print(i)
... 
ETH_CLOCK_GPIO0_IN
ETH_CLOCK_GPIO16_OUT
ETH_CLOCK_GPIO17_OUT
...

Also added catch events for ethernet module:

I (44868) ethernet: start
True
>>> I (48868) ethernet: LAN cable connected
I (49798) event: eth ip: 10.0.0.137, mask: 255.255.255.0, gw: 10.0.0.1
I (49798) ethernet: Got IP
I (64868) ethernet: LAN cable disconnected
I (72868) ethernet: LAN cable connected
I (73798) event: eth ip: 10.0.0.137, mask: 255.255.255.0, gw: 10.0.0.1
I (73798) ethernet: Got IP

should fix #4502

Later I think about do some events like wifi has. But for fix work with different clock modes should be this enough.

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