-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlan8720.py
32 lines (27 loc) · 1 KB
/
lan8720.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# LAN8720 MODULE
#GPIO00 - EMAC_TX_CLK : nINT/REFCLK (50MHz)
#GPIO16 - SMI_MDC : MDC (relocateable)
#GPIO17 - SMI_MDIO : MDIO (relocateable)
#GPIO19 - EMAC_TXD0 : TX0
#GPIO21 - EMAC_TX_EN : TX_EN
#GPIO22 - EMAC_TXD1 : TX1
#GPIO25 - EMAC_RXD0 : RX0
#GPIO26 - EMAC_RXD1 : RX1
#GPIO27 - EMAC_RX_DV : CRS
#GND : GND
#3V3 : VCC
# press RESET or power ON/OFF ESP32 several times until it boots
# speed: ftp get from ESP32 flash is 300KB/s (3Mbps)
# some free pins recommended for ESP32 to be used as JTAG programmer
#GPIO23 JTAG_TDI
#GPIO34 JTAG_TDO (was 19)
#GPIO18 JTAG_TCK
#GPIO5 JTAG_TMS (was 21)
import network
from machine import Pin
lan = network.LAN(mdc=Pin(16), mdio=Pin(17), power=None, id=None, phy_addr=1, phy_type=network.PHY_LAN8720)
lan.active(True)
# by default (no parameters), ifconfig() will request DHCP
lan.ifconfig()
# set fixed IP (address, netmask, gateway, dns)
#lan.ifconfig(('192.168.18.190', '255.255.255.0', '192.168.18.254', '192.168.18.254'))