Skip to content

Commit 8e86a55

Browse files
authored
Merge pull request #4949 from TD-er/bugfix/IPv6_ESP32_address
[ESP32 IPv6] Fix getting IPv6 address on ESP32 classic
2 parents 481fe3b + 711bedb commit 8e86a55

37 files changed

+957
-232
lines changed

docs/source/Hardware/Hardware.rst

+89-13
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
Hardware page
44
*************
55

6-
Overview
7-
========
86

97
ESPEasy has some centralized hardware configuration settings, shown in this page, and divided in sections.
108

@@ -203,13 +201,34 @@ To activate a new configuration, a reboot is needed.
203201
Ethernet PHY type
204202
^^^^^^^^^^^^^^^^^
205203

206-
Select the used PHY controller type:
204+
ESP boards can be equiped with Ethernet.
205+
This is more stable and reliable compared to WiFi and allows for better responsiveness.
207206

208-
* LAN8710 (LAN8720 is also supported, but none of the newer features are supported)
209-
* TLK110
210-
* RTL8201 (since ESP32 IDF 4.4)
211-
* DP83848 (since ESP32 IDF 4.4)
212-
* DM9051 (since ESP32 IDF 4.4)
207+
Actual transfer speed (at least when using RMII) is also higher than can be achieved via WiFi, but this is less of a concern for typical use cases where ESPEasy is used.
208+
209+
Ethernet chips/boards for ESP32-variant boards exist with 2 types of interfaces to the ESP.
210+
211+
* RMII interface - Faster actual transfer speeds possible, uses more GPIO pins, only supported on ESP32-classic (and upcoming ESP32-P4).
212+
* SPI interface - (Added: 2024/02) Supported on all ESP32-variants (not all tested) on builds based on ESP-IDF 5.1
213+
SPI Ethernet adapters do obviously require the SPI interface to be configured.
214+
215+
N.B. Only ESP32-variant builds with LittleFS support SPI Ethernet. (starting February 2024)
216+
217+
Supported Ethernet chips:
218+
219+
* RMII Interface:
220+
* LAN8710 (LAN8720 is also supported, but none of the newer features are supported)
221+
* TLK110
222+
* RTL8201 (since ESP32 IDF 4.4)
223+
* JL1101 (since ESP32 IDF 4.4)
224+
* DP83848 (since ESP32 IDF 4.4)
225+
* KSZ8041 (since ESP32 IDF 4.4)
226+
* KSZ8081 (since ESP32 IDF 4.4)
227+
228+
* SPI Interface: (since ESP32 IDF 5.1)
229+
* DM9051
230+
* W5500
231+
* KSZ8851
213232

214233
.. note:: The LAN8710 and LAN8720 are also available with an "A" suffix.
215234
These are the same chips, only produced after the brand SMSC was taken over by Microchip Technology.
@@ -219,19 +238,22 @@ Ethernet PHY Address
219238

220239
The PHY address depends on the hardware and the PHY configuration.
221240
On some chips, like the LAN8720, the board designer may set this address by pulling some pins either high or low at power on.
222-
In theory, one could use multiple PHY adapters on the same RMII bus, but this is not supported by ESPEasy.
241+
In theory, one could use multiple PHY adapters on the same RMII/SPI bus, but this is (currently) not supported by ESPEasy.
223242

224243
* Espressif's Ethernet board with TLK110 PHY use PHY address 31.
225244
* Common Waveshare LAN8720 PHY breakout board (and clones) use PHY address 1.
226245
* Olimex ESP32 EVB REV B IoT LAN8710 PHY Board with CAN use PHY address 0.
227246
* Other LAN8720 breakouts often use PHY address 0.
247+
* ETH01-EVO (ESP32-C3 based board) uses PHY address 1.
228248

229249
If the PHY address is incorrect then the EMAC will initialise but all attempts to read/write configuration registers on the PHY will fail.
230250

231251
N.B. There is support for an auto detect of this PHY address, by setting it to -1, but at least on the LAN8720 this does not seem to work.
232252

233-
GPIO pins
234-
^^^^^^^^^
253+
RMII Ethernet
254+
^^^^^^^^^^^^^
255+
256+
As mentioned above, the RMII interface is only present on ESP32-classic (and is mentioned on the announced ESP32-P4).
235257

236258
RMII PHY SMI Wiring
237259
"""""""""""""""""""
@@ -281,7 +303,41 @@ Apart from these GPIO pins, there is a number of other pins reserved on the ESP3
281303
Since these GPIO pin assignments cannot be changed, it is also not needed to configure them.
282304
However, they also cannot be used when *RMII PHY* is used.
283305

284-
.. include:: ../Reference/Ethernet_PHY_ESP32.rst
306+
.. include:: ../Reference/RMII_Ethernet_PHY_ESP32.rst
307+
308+
RMII Ethernet ESP32 Boards
309+
""""""""""""""""""""""""""
310+
311+
.. include:: ../Reference/RMII_Ethernet_ESP32_boards.rst
312+
313+
314+
SPI Ethernet
315+
^^^^^^^^^^^^
316+
317+
(Added: 2024/02)
318+
319+
As mentioned above, these SPI based Ethernet interfaces require the SPI interface to be configured.
320+
321+
The SPI bus can be shared, but the SPI Ethernet chips are a bit specific about the used frequency.
322+
Currently the default SPI frequency of 20 MHz is used, so not all other SPI devices may work together with SPI Ethernet.
323+
324+
Some boards like the ETH01-EVO (ESP32-C3 based) do not even have the SPI bus pins made accesible.
325+
326+
327+
GPIO Configuration
328+
""""""""""""""""""
329+
330+
* CS pin: Just as any SPI device, it needs a CS pin to tell the device it is being addressed.
331+
* IRQ/INT pin: Allows the Ethernet chip to signal the ESP about new data. (Optional for W5500)
332+
* RST pin: ESP will try to reset the Ethernet adapter during boot. Not all boards may have this wired.
333+
334+
335+
SPI Ethernet ESP32 Boards
336+
"""""""""""""""""""""""""
337+
338+
.. include:: ../Reference/SPI_Ethernet_ESP32_boards.rst
339+
340+
285341

286342
Ethernet with PoE
287343
^^^^^^^^^^^^^^^^^
@@ -291,13 +347,33 @@ Some ethernet boards support Power over Ethernet (PoE), so only a single (ethern
291347
For Olimex boards in the ESP32-POE range, the supplier has documented this warning:
292348

293349
.. warning::
294-
**Important notice**: Olimex ESP32-PoE has **no galvano isolation** from Ethernet's power supply, when you program the board via the micro USB connector the Ethernet cable should be disconnected (if you have power over the Ethernet cable)!
350+
**Important notice**: Olimex ESP32-PoE has **no galvanic isolation** from Ethernet's power supply, when you program the board via the micro USB connector the Ethernet cable should be disconnected (if you have power over the Ethernet cable)!
295351

296352
Consider using Olimex USB-ISO to protect your computer and board from accidental short circuit. Also consider instead using Olimex ESP32-PoE-ISO board, which *is* insulated.
297353

298354
Most likely, this warning is applicable to other brands as well.
299355

300356

357+
Ethernet Isolation
358+
^^^^^^^^^^^^^^^^^^
359+
360+
Most Ethernet RJ45 phy (the connector on the PCB) have isolation transformers in them.
361+
This does isolate the TX/RX pins to make sure there is no direct connection between the long cables and the Ethernet controller chip.
362+
The isolation does protect the Ethernet chip from picked up high voltage spikes and ESD surges when inserting the Ethernet cable.
363+
However not all ESP boards with Ethernet have these installed.
364+
365+
Apart from the isolation of the TX/RX pins the metallic enclosure of the phy should also be isolated from the rest of the circuit of the ESP board.
366+
Typically this is done by connecting the metal enclosure of the phy via a capacitor to GND of the rest of the circuit.
367+
A lot of boards with Ethernet have these directly connected to GND, which may impose a problem when connecting the ESP board to your PC.
368+
369+
.. warning::
370+
**Important notice**: For ESP boards with Ethernet which need debugging, never use Ethernet cables with metal shielding on the Ethernet connector.
371+
372+
Using shielded Ethernet cable will connect the metal shield of the RJ45 phy to the ground of the switch and this may be connected to other appliances which may be badly grounded.
373+
This will add a significant voltage offset between the ESP board and your PC while debugging.
374+
Such a high voltage is very likely to destroy electronics.
375+
376+
301377
-------------------
302378
GPIO boot states
303379
-------------------

docs/source/Reference/GPIO.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Typical uses in ESPEasy where an interrupt of a GPIO pin is used are:
325325
Pins used for RMII Ethernet PHY
326326
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
327327

328-
.. include:: ../Reference/Ethernet_PHY_ESP32.rst
328+
.. include:: ../Reference/RMII_Ethernet_PHY_ESP32.rst
329329

330330

331331
Best pins to use on ESP32-C3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
3+
There is a number of ESP32 boards available with Ethernet connected via RMII.
4+
5+
However it is not always clear which configuration should be used.
6+
7+
8+
.. warning::
9+
**Important notice**: It is possible to actually damage the Ethernet chip when a wrong configuration is used.
10+
11+
.. list-table:: RMII PHY Boards
12+
:widths: 30 15 10 10 10 20 30
13+
:header-rows: 1
14+
15+
* - Board
16+
- Ethernet Chip
17+
- Addr
18+
- MDC
19+
- MDIO
20+
- Power/RST
21+
- Clock
22+
* - Olimex ESP32 PoE
23+
- LAN8720
24+
- 0
25+
- 23
26+
- 18
27+
- 12
28+
- 50MHz Inv Output GPIO17
29+
* - Olimex ESP32 EVB
30+
- LAN8720
31+
- 0
32+
- 23
33+
- 18
34+
- (no power pin)
35+
- External clock
36+
* - Olimex ESP32 Gateway
37+
- LAN8720
38+
- 0
39+
- 23
40+
- 18
41+
- 5
42+
- 50MHz Inv Output GPIO17
43+
* - wESP32
44+
- LAN8720
45+
- 0
46+
- 16
47+
- 17
48+
- (no power pin)
49+
- External clock
50+
* - WT32 ETH01
51+
- LAN8720
52+
- 1
53+
- 23
54+
- 18
55+
- ?
56+
- External clock
57+
* - TTGO T-Internet-POE ESP32
58+
- LAN8720
59+
- 0
60+
- 23
61+
- 18
62+
- 5 (RST)
63+
- 50MHz Inv Output GPIO17
64+
* - TTGO T-ETH-POE-PRO
65+
- LAN8720
66+
- 0
67+
- 23
68+
- 18
69+
- 5 (RST)
70+
- 50MHz Output GPIO0
71+
* - TTGO T-INTER_COM
72+
- LAN8720
73+
- 0
74+
- 23
75+
- 18
76+
- 4 (RST)
77+
- 50MHz Output GPIO0
78+
* - TTGO T-EH-Lite-ESP32
79+
- RTL8201
80+
- 0
81+
- 23
82+
- 18
83+
- 12
84+
- External clock
85+
86+
See:
87+
88+
* `ESP32 datasheet <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf>`_
89+
* `TTGO/LilyGO Ethernet boards <https://github.com/Xinyuan-LilyGO/LilyGO-T-ETH-Series/blob/dda7a2ad4ab33d550c8dbaff5db1e61a0eda5aad/examples/ETHOTA/utilities.h#L12>`_
90+
* `Olimex ESP32-PoE <https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware>`_
91+
* `Olimex ESP32-POE-ISO <https://www.olimex.com/Products/IoT/ESP32/ESP32-POE-ISO/open-source-hardware>`_
92+
* `Olimex ESP32-EVB <https://www.olimex.com/Products/IoT/ESP32/ESP32-EVB/open-source-hardware>`_
93+
* `Olimex ESP32-GATEWAY <https://www.olimex.com/Products/IoT/ESP32/ESP32-GATEWAY/open-source-hardware>`_

docs/source/Reference/Ethernet_PHY_ESP32.rst docs/source/Reference/RMII_Ethernet_PHY_ESP32.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ The following PHY connections are required for RMII PHY data connections:
1010
- RMII Signal
1111
- ESP32 EMAC Function
1212
- Notes
13-
* - 0
13+
* - 0 / 16 / 17
1414
- REF_CLK
1515
- EMAC_TX_CLK
1616
- See desciption about the clock
17+
* - 18
18+
- MDIO
19+
- EMAC_MDIO
20+
- In theory user configurable, but almost always used as MDIO pin
21+
* - 23
22+
- MDC
23+
- EMAC_MDC
24+
- In theory user configurable, but almost always used as MDC pin
1725
* - 21
1826
- TX_EN
1927
- EMAC_TX_EN

0 commit comments

Comments
 (0)