@@ -68,6 +68,9 @@ by reading the temperature sensor immediately after waking up from sleep.
68
68
Networking
69
69
----------
70
70
71
+ WLAN
72
+ ^^^^
73
+
71
74
The :mod: `network ` module::
72
75
73
76
import network
@@ -110,6 +113,67 @@ calling ``wlan.config(reconnects=n)``, where n are the number of desired reconne
110
113
attempts (0 means it won't retry, -1 will restore the default behaviour of trying
111
114
to reconnect forever).
112
115
116
+ LAN
117
+ ^^^
118
+
119
+ To use the wired interfaces one has to specify the pins and mode ::
120
+
121
+ import network
122
+
123
+ lan = network.LAN(mdc=PIN_MDC, ...) # Set the pin and mode configuration
124
+ lan.active(True) # activate the interface
125
+ lan.ifconfig() # get the interface's IP/netmask/gw/DNS addresses
126
+
127
+
128
+ The keyword arguments for the constructor defining the PHY type and interface are:
129
+
130
+ - mdc=pin-object # set the mdc and mdio pins.
131
+ - mdio=pin-object
132
+ - power=pin-object # set the pin which switches the power of the PHY device.
133
+ - phy_type=<type> # Select the PHY device type. Supported devices are PHY_LAN8710,
134
+ PHY_LAN8720, PH_IP101, PHY_RTL8201, PHY_DP83848 and PHY_KSZ8041
135
+ - phy_addr=number # The address number of the PHY device.
136
+ - ref_clk_mode=mode # Defines, whether the ref_clk at the ESP32 is an input
137
+ or output. Suitable values are Pin.IN and Pin.OUT.
138
+ - ref_clk=pin-object # defines the Pin used for ref_clk.
139
+
140
+ The options ref_clk_mode and ref_clk require at least esp-idf version 4.4. For
141
+ earlier esp-idf versions, these parameters must be defined by kconfig board options.
142
+
143
+ These are working configurations for LAN interfaces of popular boards::
144
+
145
+ # Olimex ESP32-GATEWAY: power controlled by Pin(5)
146
+ # Olimex ESP32 PoE and ESP32-PoE ISO: power controlled by Pin(12)
147
+
148
+ lan = network.LAN(mdc=machine.Pin(23), mdio=machine.Pin(18), power=machine.Pin(5),
149
+ phy_type=network.PHY_LAN8720, phy_addr=0)
150
+
151
+ # or with dynamic ref_clk pin configuration
152
+
153
+ lan = network.LAN(mdc=machine.Pin(23), mdio=machine.Pin(18), power=machine.Pin(5),
154
+ phy_type=network.PHY_LAN8720, phy_addr=0,
155
+ ref_clk=machine.Pin(17), ref_clk_mode=machine.Pin.OUT)
156
+
157
+ # Wireless-Tag's WT32-ETH01
158
+
159
+ lan = network.LAN(mdc=machine.Pin(23), mdio=machine.Pin(18),
160
+ phy_type=network.PHY_LAN8720, phy_addr=1, power=None)
161
+
162
+ # Espressif ESP32-Ethernet-Kit_A_V1.2
163
+
164
+ lan = network.LAN(id=0, mdc=Pin(23), mdio=Pin(18), power=Pin(5),
165
+ phy_type=network.PHY_IP101, phy_addr=1)
166
+
167
+ A suitable definition of the PHY interface in a sdkconfig.board file is::
168
+
169
+ CONFIG_ETH_PHY_INTERFACE_RMII=y
170
+ CONFIG_ETH_RMII_CLK_OUTPUT=y
171
+ CONFIG_ETH_RMII_CLK_OUT_GPIO=17
172
+ CONFIG_LWIP_LOCAL_HOSTNAME="ESP32_POE"
173
+
174
+ The value assigned to CONFIG_ETH_RMII_CLK_OUT_GPIO may vary depending on the
175
+ board's wiring.
176
+
113
177
Delay and timing
114
178
----------------
115
179
0 commit comments