Actions

KAmodESP32 ETH POE: Difference between revisions

From Kamamilabs.com - Wiki

 
(11 intermediate revisions by the same user not shown)
Line 18: Line 18:
<br><br>
<br><br>


===== Wyposażenie standardowe =====
===== Standard Equipment =====
<center>
<center>
{| class="wikitable" style="width: 800px;"
{| class="wikitable" style="width: 800px;"
|-
|-
! style="text-align: center;"|Kod
! style="text-align: center;"|Code
! style="text-align: center;"|Opis
! style="text-align: center;"|Description
|-
|-
| style="text-align: center;"|<b>KAmodESP32 ETH+POE </b>
| style="text-align: center;"|<b>KAmodESP32 ETH+POE </b>
| style="text-align: center;"| Zmontowany i uruchomiony moduł
| style="text-align: center;"| Assembled and launched module


|}
|}
Line 32: Line 32:
<br><br>
<br><br>


===== Schemat elektryczny =====
===== Electrical diagram =====
Moduł ESP32 <br>
ESP32 module <br>
<center>
<center>
[[File:KAmodESP32-POE sch1.png|none|900px|thumb|center]]
[[File:KAmodESP32-POE sch1.png|none|900px|thumb|center]]
</center>
</center>
<br>
<br>
Elementy odpowiedzialne za funkcje resetu i programowania
Elements responsible for reset and programming functions
<center>
<center>
[[File:KAmodESP32-POE sch2.png|none|350px|thumb|center]]
[[File:KAmodESP32-POE sch2.png|none|350px|thumb|center]]
</center>
</center>


Złącze GPIO
GPIO connector
<center>
<center>
[[File:KAmodESP32-POE sch_gpio.png|none|700px|thumb|center]]
[[File:KAmodESP32-POE sch_gpio.png|none|700px|thumb|center]]
</center>
</center>


Diody sygnalizacyjne
Indicator diodes
<center>
<center>
[[File:KAmodESP32-POE sch3.png|none|400px|thumb|center]]
[[File:KAmodESP32-POE sch3.png|none|400px|thumb|center]]
</center>
</center>


Interfejs Ethernet
Ethernet interface
<center>
<center>
[[File:KAmodESP32-POE sch4.png|none|1100px|thumb|center]]
[[File:KAmodESP32-POE sch4.png|none|1100px|thumb|center]]
</center>
</center>


Zasilanie PoE
PoE power supply
<center>
<center>
[[File:KAmodESP32-POE sch5.png|none|700px|thumb|center]]
[[File:KAmodESP32-POE sch5.png|none|700px|thumb|center]]
</center>
</center>


Interfejs USB-UART
USB-UART interface
<center>
<center>
[[File:KAmodESP32-POE sch6.png|none|600px|thumb|center]]
[[File:KAmodESP32-POE sch6.png|none|600px|thumb|center]]
</center>
</center>


Źródło sygnału taktującego
Source of the clocking signal
<center>
<center>
[[File:KAmodESP32-POE sch7.png|none|650px|thumb|center]]
[[File:KAmodESP32-POE sch7.png|none|650px|thumb|center]]
</center>
</center>


Blok zasilania o napięciu 3,3 V
3.3V power block
<center>
<center>
[[File:KAmodESP32-POE sch8.png|none|400px|thumb|center]]
[[File:KAmodESP32-POE sch8.png|none|400px|thumb|center]]
</center>
</center>


=====Interfejs Ethernet=====
=====Ethernet Interface=====
<center>
<center>
{| class="wikitable" style="width: 800px;"
{| class="wikitable" style="width: 800px;"
|-
|-
! style="text-align: center;"|Złącze
! style="text-align: center;"|Connector
! style="text-align: center;"|Funkcja
! style="text-align: center;"|Function
|-
|-
| style="text-align: center;"|<b>J2 – ETH & PoE</b>
| style="text-align: center;"|<b>J2 – ETH & PoE</b>
(RJ45)
(RJ45)
| style="text-align: left;"|
| style="text-align: left;"|
* Umożliwia połączenie kablowe z siecią internetową
* Allows cable connection to the Internet
|}
|}
</center>
</center>
<br>
<br>
Na płytce KAmod ESP32 ETH+POE został zaimplementowany przewodowy interfejs Ethernet z klasycznym gniazdem RJ45 (J2). W roli drivera (PHY) interfejsu Ethernet zastosowano układ <b>LAN8742</b>, który jest kompatybilny z <b>LAN8720</b> i jest wspierany w środowisku Arduino. Może działać z prędkościami 100 Mb lub 10 Mb w trybie Full-Duplex lub Half-Duplex.<br><br>
The KAmod ESP32 ETH+POE board implements a wired Ethernet interface with a classic RJ45 socket (J2). The <b>LAN8742</b> chip, which is compatible with <b>LAN8720</b> and supported in the Arduino environment, is used as the driver (PHY) of the Ethernet interface. It can operate at 100 Mb or 10 Mb in Full-Duplex or Half-Duplex mode.<br><br>
Driver Ethernet jest połączony z modułem ESP32 poprzez interfejs RMII (Reduced media-independent interface). Przyporządkowanie sygnałów opisuje tabela:
The Ethernet driver is connected to the ESP32 module via the RMII interface (Reduced media-independent interface). The signal assignment is described in the table:
<br><br>
<br><br>
<center>
<center>
{| class="wikitable" style="width: 600px;"
{| class="wikitable" style="width: 600px;"
|-
|-
! style="text-align: center;"|Sygnał RMII
! style="text-align: center;"|RMII Signal
! style="text-align: center;"|Kierunek
! style="text-align: center;"|Direction
! style="text-align: center;"|Wyprowadzenie modułu ESP32
! style="text-align: center;"|ESP32 Module Pinout
|-
|-
| style="text-align: center;"|
| style="text-align: center;"|
Line 178: Line 178:
</center>
</center>


===== Zasilanie metodą PoE =====
===== Power by PoE =====
<center>
<center>
{| class="wikitable" style="width: 800px;"
{| class="wikitable" style="width: 800px;"
|-
|-
! style="text-align: center;"|Złącze
! style="text-align: center;"|Connector
! style="text-align: center;"|Funkcja
! style="text-align: center;"|Function
|-
|-
| style="text-align: center;"|<b>J2 – ETH & PoE</b>
| style="text-align: center;"|<b>J2 – ETH & PoE</b>
(RJ45)
(RJ45)
| style="text-align: left;"|
| style="text-align: left;"|
:* Odbiera zasilanie z instalacji PoE
:* Receives power from PoE installation
|}
|}
</center>
</center>
Poprzez złącze <b>ETH & PoE </b>(J2) może być dostarczane zasilanie do płytki ewaluacyjnej. Zastosowany kontroler zasilania PoE bazuje na układzie MP8007, który jest kompatybilny ze standardami <b>IEEE 802.3af</b> - Powered Devices Type-1 oraz <b>IEEE 802.3at</b> - Powered Devices Type-2. Blok zasilania PoE jest skonfigurowany do pracy w klasie 0 (Class 0), która definiuje pobór mocy urządzenia w zakresie 0,5...13 W.<br><br>
The <b>ETH & PoE</b> connector (J2) can be used to supply power to the evaluation board. The PoE power controller used is based on the MP8007 system, which is compatible with the <b>IEEE 802.3af</b> - Powered Devices Type-1 and <b>IEEE 802.3at</b> - Powered Devices Type-2 standards. The PoE power block is configured to operate in Class 0, which defines the device's power consumption in the range of 0.5...13 W.<br><br>
Zasilanie metodą PoE jest możliwe tylko w kompatybilnej instalacji, zawierającej urządzenie PSE (Power Sourcing Equipments) spełniające standard IEEE 802.3af/at np. router PoE. Prawidłowe działanie bloku zasilania PoE jest sygnalizowane świeceniem diody POE (D4). W czasie pracy bloku zasilania PoE, może być słyszalny szum lub cichy pisk – jest to naturalne zjawisko wywołane działaniem przetwornicy impulsowej (SMPS).<br><br>
Power supply using the PoE method is only possible in a compatible installation containing a PSE (Power Sourcing Equipments) device that meets the IEEE 802.3af/at standard, e.g. a PoE router. The correct operation of the PoE power block is indicated by the lighting of the POE diode (D4). During the operation of the PoE power supply unit, noise or a quiet squeak may be heard - this is a natural phenomenon caused by the operation of the switching power supply (SMPS).<br><br>
Przy właściwym zasilaniu płytki ewaluacyjnej KAmod ESP32 ETH+POE wytwarzane są napięcia stabilizowane ok. 5 V oraz 3,3 V, dostępne na złączy szpilkowym J1. Mogą posłużyć do zasilania innych modułów dołączonych do płytki ewaluacyjnej, należy jednak pamiętać, aby sumaryczny prąd nie powinien przekraczać 1,5 A.<br><br>
When the KAmod ESP32 ETH+POE evaluation board is properly powered, stabilized voltages of approx. 5 V and 3.3 V are generated, available on the J1 pin connector. They can be used to power other modules connected to the evaluation board, but remember that the total current should not exceed 1.5 A.<br><br>
W instalacji PoE występują napięcia o wartościach sięgających aż <b>60 V</b>. Wszelkie czynności wykonywane w takich instalacjach z użyciem płytki ewaluacyjnej KAmod ESP32 ETH+POE należy wykonywać ze szczególną ostrożnością i z zachowaniem zasad bezpieczeństwa.
In the PoE installation, voltages with values ​​​​of up to <b>60 V</b> occur. All activities performed in such installations using the KAmod ESP32 ETH+POE evaluation board should be performed with special caution and in compliance with safety rules. <br><br>
<br><br>
<center>
<center>
[[File:KAmodESP32-POE_poe.png|none|600px|thumb|center]]
[[File:KAmodESP32-POE_poe.png|none|600px|thumb|center]]
Line 201: Line 200:
<br><br>
<br><br>


===== Interfejs USB =====
===== USB Interface =====
<center>
<center>
{| class="wikitable" style="width: 800px;"
{| class="wikitable" style="width: 800px;"
|-
|-
! style="text-align: center;"|Złącze
! style="text-align: center;"|Connector
! style="text-align: center;"|Funkcja
! style="text-align: center;"|Function
|-
|-
| style="text-align: center;"|<b>P1 – COM&POW</b>
| style="text-align: center;"|<b>P1 – COM&POW</b>
(USB-C)
(USB-C)
| style="text-align: left;"|
| style="text-align: left;"|
:* Realizuje funkcję konwertera USB-UART
:* Performs the function of a USB-UART converter
:* Umożliwia programowanie modułu ESP32
:* Allows programming of the ESP32 module
:* Jest alternatywnym wejściem zasilania
:* Is an alternative power input
|}
|}
</center>
</center>
Złącze P1 typu USB-C jest połączone z kontrolerem typu CH340, który realizuje funkcje konwertera USB-UART. Interfejs UART może być używany w docelowej aplikacji, ale służy także do programowania modułu ESP32. Proces programowania może przebiegać całkowicie automatycznie, ponieważ kontroler CH340 steruje kluczowymi wyprowadzeniami modułu ESP32 ('''GPIO0''' ''Boot Select'' oraz '''EN''' - ''Chip Power-up'').
The P1 USB-C connector is connected to the CH340 type controller, which performs the functions of a USB-UART converter. The UART interface can be used in the target application, but it is also used to program the ESP32 module. The programming process can be completely automatic, because the CH340 controller controls the key pins of the ESP32 module ('''GPIO0''' - ''Boot Select'' and '''EN''' - ''Chip Power-up'').
<br><br>
<br><br>
Połączenia sygnałów pomiędzy CH340 i ESP32 są następujące:
The signal connections between CH340 and ESP32 are as follows:
<center>
<center>
{| class="wikitable" style="width: 800px;"
{| class="wikitable" style="width: 800px;"
|-
|-
! style="text-align: center;"|Sygnał kontrolera CH340
! style="text-align: center;"|CH340 controller signal
! style="text-align: center;"|Wyprowadzenie modułu ESP32
! style="text-align: center;"|ESP32 module pinout
|-
|-
| style="text-align: center;"|TXD (wyjście danych)
| style="text-align: center;"|TXD (data output)
| style="text-align: center;"|GPIO03 (UART0 RXD)
| style="text-align: center;"|GPIO03 (UART0 RXD)
|-
|-
| style="text-align: center;"|RXD (wejście danych)
| style="text-align: center;"|RXD (data input)
| style="text-align: center;"|GPIO01 (UART0 TXD)
| style="text-align: center;"|GPIO01 (UART0 TXD)
|-
|-
| style="text-align: center;"|DTR (wyście kontroli transmisji)
| style="text-align: center;"|DTR (transmission control output)
| style="text-align: center;"|EN (Chip Power-up)
| style="text-align: center;"|EN (Chip Power-up)
|-
|-
| style="text-align: center;"|RTS (wyjście kontroli transmisji)
| style="text-align: center;"|RTS (transmission control output)
| style="text-align: center;"|GPIO0 (Boot Select)
| style="text-align: center;"|GPIO0 (Boot Select)
|}
|}
</center>
</center>
Do linii TXD jest dołączona dioda led oznaczona USB (D3), która sygnalizuje odbieranie danych z interfejsu USB. W przypadku użycia w docelowej aplikacji konwertera USB-UART należy zadbać o to, aby linie DTR oraz RTS pozostały nieobsługiwane (''Handshaking: None'').
The TXD line is connected to an LED marked USB (D3), which signals the reception of data from the USB interface. If a USB-UART converter is used in the target application, it is necessary to ensure that the DTR and RTS lines remain unsupported (''Handshaking: None'').
<br><br>
<br><br>
Złącze USB-C może służyć jako alternatywne wejście zasilania dla płytki KAmod ESP32 ETH+POE, jednak wtedy parametry obwodów zasilania nie będą spełnione. Napięcie na linii 5 V, będzie niższe i będzie wynosiło ok. 4,5 V; napięcie na linii 3,3 V nie powinno się zmienić; wydajność prądowa napięć 5 V oraz 3,3 V może być dużo niższa i będzie zależała od zastosowanego zasilania na złączu USB-C.
The USB-C connector can be used as an alternative power input for the KAmod ESP32 ETH+POE board, but then the parameters of the power supply circuits will not be met. The voltage on the 5 V line will be lower and will be around 4.5 V; the voltage on the 3.3 V line should not change; the current efficiency of the 5 V and 3.3 V voltages may be much lower and will depend on the power supply used on the USB-C connector.
<center>
<center>
[[File:KAmodESP32-POE_usb.png|none|600px|thumb|center]]
[[File:KAmodESP32-POE_usb.png|none|600px|thumb|center]]
Line 246: Line 245:
<br><br>
<br><br>


===== Przyciski resetowania i programowania =====
===== Reset and Programming Buttons =====
<center>
<center>
{| class="wikitable" style="width: 1000px;"
{| class="wikitable" style="width: 1000px;"
|-
|-
! style="text-align: center;"|Komponent
! style="text-align: center;"|Component
! style="text-align: center;"|Funkcja
! style="text-align: center;"|Function
|-
|-
| style="text-align: center;"|Przycisk SW1 – '''PROG'''
| style="text-align: center;"|SW1 Button – '''PROG'''
| style="text-align: left;"|
| style="text-align: left;"|
:* Uruchamia tryb programowania poprzez UART (tylko w momencie restartu modułu ESP32)
:* Starts programming mode via UART (only when the ESP32 module is restarted)
|-
|-
| style="text-align: center;"|Przycisk SW2 – '''RESET'''
| style="text-align: center;"|SW2 Button – '''RESET'''
| style="text-align: left;"|
| style="text-align: left;"|
:* Powoduje restart modułu ESP32 oraz kontrolera interfejsu Ethernet
:* Restarts the ESP32 module and the Ethernet interface controller
|}
|}
</center>
</center>
Przycisk RESET umożliwia wykonanie restartu modułu ESP32 oraz, jednocześnie kontrolera interfejsu Ethernet. Jest połączony z linią EN (''Chip Power-up'') modułu ESP32.
The RESET button allows you to restart the ESP32 module and, at the same time, the Ethernet interface controller. It is connected to the EN (''Chip Power-up'') line of the ESP32 module.
<br><br>
<br><br>
Przycisk PROG pozwala wprowadzić moduł ESP32 w tryb programowania. Należy wtedy nacisnąć przycisk RESET, następnie, trzymając wciśnięty RESET, przytrzymać przycisk PROG i wtedy zwolnić RESET, jednocześnie trzymając jeszcze przez chwilę wciśnięty PROG. Funkcjonalność ta może być przydatna, gdy z jakiegoś powodu tryb programowania nie będzie uruchamiany automatycznie poprzez konwerter USB-UART.
The PROG button allows you to enter the ESP32 module into programming mode. Then you should press the RESET button, then, while holding RESET, hold the PROG button and then release RESET, while still holding PROG for a moment. This functionality can be useful when for some reason the programming mode is not started automatically via the USB-UART converter.
<center>
<center>
[[File:KAmodESP32-POE_res.png|none|600px|thumb|center]]
[[File:KAmodESP32-POE_res.png|none|600px|thumb|center]]
Line 270: Line 269:
<br><br>
<br><br>


===== Kontrolki sygnalizacyjne =====
===== Signal lights =====
<center>
<center>
{| class="wikitable" style="width: 850px;"
{| class="wikitable" style="width: 850px;"
|-
|-
! style="text-align: center;"|Komponent
! style="text-align: center;"|Component
! style="text-align: center;"|Funkcja
! style="text-align: center;"|Function
|-
|-
| style="text-align: center;"|D3 – '''USB'''
| style="text-align: center;"|D3 – '''USB'''
| style="text-align: left;"|
| style="text-align: left;"|
:* Miganie diody D3 oznacza przesyłanie danych z USB do modułu ESP32
:* D3 LED flashing means data is being transferred from USB to the ESP32 module
|-
|-
| style="text-align: center;"|D4 – '''POE'''
| style="text-align: center;"|D4 – '''POE'''
| style="text-align: left;"|
| style="text-align: left;"|
:* Świecenie diody D4 oznacza prawidłowe działanie modułu zasilania PoE
:* D4 LED lighting means the PoE power supply module is working properly
|-
|-
| style="text-align: center;"|D5 – '''POW'''
| style="text-align: center;"|D5 – '''POW'''
| style="text-align: left;"|
| style="text-align: left;"|
:* Świecenie diody D5 oznacza obecność głównego napięcia zasilającego - napięcia 3,3 V
:* The D5 diode lighting up indicates the presence of the main supply voltage - voltage 3.3 V
|-
|-
| style="text-align: center;"|D6 – '''IO-2'''
| style="text-align: center;"|D6 – '''IO-2'''
| style="text-align: left;"|
| style="text-align: left;"|
:* Dioda D6 jest dołączona do wyprowadzenia GPIO2 modułu ESP32 i jej świecenie może być sterowane programowo
:* The D6 diode is connected to the GPIO2 pin of the ESP32 module and its lighting up can be controlled by software
|}
|}
</center>
</center>
Na płytce KAmod ESP32 ETH+POE znajdują się 4 diody LED, które sygnalizują działanie różnych komponentów – zgodnie z powyższą tabelą.<br><br>
There are 4 LEDs on the KAmod ESP32 ETH+POE board, which signal the operation of various components - according to the table above.<br><br>
Dioda D6 (LED IO-2) jest dołączona do wyprowadzenia GPIO2 modułu ESP32. Jej zaświecenie wymaga programowego ustawienia stanu wysokiego na wyprowadzeniu GPIO2.<br><br>
The D6 diode (LED IO-2) is connected to the GPIO2 pin of the ESP32 module. Its lighting up requires a programmatic setting of the high state on the GPIO2 pin.<br><br>
Dodatkowe dwie diody sygnalizacyjne znajdują się na złączu J2. Dioda po lewej stronie (POWER) sygnalizuje obecność głównego napięcia zasilającego - napięcia 3,3 V. Dioda po prawej stronie (LINK) miganiem sygnalizuje aktywność interfejsu Ethernet.
The additional two signaling diodes are located on the J2 connector. The diode on the left (POWER) indicates the presence of the main supply voltage - voltage 3.3 V. The diode on the right (LINK) flashes to indicate the activity of the Ethernet interface.
<center>
<center>
[[File:KAmodESP32-POE_led.png|none|800px|thumb|center]]
[[File:KAmodESP32-POE_led.png|none|800px|thumb|center]]
Line 302: Line 301:
<br><br>
<br><br>


===== Złącze GPIO w standardzie RPi =====
===== GPIO connector in RPi standard =====
<center>
<center>
{| class="wikitable" style="width: 800px;"
{| class="wikitable" style="width: 800px;"
|-
|-
! style="text-align: center;"|Złącze
! style="text-align: center;"|Connector
! style="text-align: center;"|Funkcja
! style="text-align: center;"|Function
|-
|-
| style="text-align: center;"|'''J1 – Goldpin 2x20'''
| style="text-align: center;"|'''J1 – Goldpin 2x20'''
| style="text-align: left;"|
| style="text-align: left;"|
:* Złącze w standardzie Raspberry Pi
:* Raspberry Pi standard connector
:* Wyprowadzone niektóre porty GPIO modułu ESP32
:* Some GPIO ports of the ESP32 module brought out
:* Wyprowadzone linie zasilania 5 V, 3,3 V, GND
:* 5 V, 3.3 V, GND power lines brought out
|}
|}
</center>
</center>
Złącze GPIO (J1) w standardzie Raspberry Pi zawiera 40 szpilek, do których doprowadzone są linie zasilania 5 V, 3,3 V, GND oraz niektóre wyprowadzenia GPIO modułu ESP32. Wyprowadzenia interfejsów UART (TXD, RXD), I2C (SDA, SCL) oraz SPI (MOSI, MISO, SCLK, CS0) zostały rozmieszczone tak, jak ma to miejsce w płytkach rodziny Raspberry Pi.<br><br>
The Raspberry Pi standard GPIO connector (J1) contains 40 pins, to which the 5 V, 3.3 V, GND power lines and some GPIO pins of the ESP32 module are brought out. The UART (TXD, RXD), I2C (SDA, SCL) and SPI (MOSI, MISO, SCLK, CS0) interface pins have been arranged as they are in the Raspberry Pi family boards.<br><br>
Dokładny opis wyprowadzeń oraz ich funkcje pokazuje rysunek i tabela poniżej:
A detailed description of the pins and their functions is shown in the figure and table below:
<center>
<center>
[[File:KAmodESP32-POE_gpio.png|none|750px|thumb|center]]
[[File:KAmodESP32-POE_gpio.png|none|750px|thumb|center]]
</center>
</center>
Opis wyprowadzeń został również naniesiony na spodzie płytki KAmod ESP32 ETH+POE:
The description of the pins has also been marked on the bottom of the KAmod ESP32 board ETH+POE:
<center>
<center>
[[File:KAmodESP32-POE_gpio2.png|none|650px|thumb|center]]
[[File:KAmodESP32-POE_gpio2.png|none|650px|thumb|center]]
Line 328: Line 327:
[[File:KAmod_ESP32_PoE_02.jpg|none|800px|thumb|center]]
[[File:KAmod_ESP32_PoE_02.jpg|none|800px|thumb|center]]
</center>
</center>
'''Uwagi dotyczące sygnałów wyprowadzonych na złącze GPIO'''
'''Notes on signals output to GPIO connector'''
:*Porty '''GPIO 34''', '''35''', '''36''' i '''39''' modułu ESP32 mogą pracować wyłącznie jako wejścia cyfrowe lub analogowe – zostały one oznaczone symbolem IN.
:*Ports '''GPIO 34''', '''35''', '''36''' and '''39''' of the ESP32 module can only work as digital or analog inputs - they are marked with the symbol IN.
:*Porty '''GPIO 34''' i '''35''' zostały wyposażone w rezystory podciągające pull-up 10k.
:*Ports '''GPIO 34''' and '''35''' are equipped with 10k pull-up resistors.
:*Porty '''GPIO 36''' i '''39''' zostały wyposażone w dzielniki napięcia (100k/10k), dzięki czemu można do nich dołączyć napięcie o maksymalnej wartości 35 V.
:*Ports '''GPIO 36''' and '''39''' are equipped with voltage dividers (100k/10k), thanks to which a maximum voltage of 35 V can be connected to them.
:*Porty '''GPIO 32''' i '''33''' zostały dostosowane do funkcjonalności magistrali I2C i zawierają rezystory podciągające pull-up 2,2k.
:*Ports '''GPIO 32''' and '''33''' are adapted to the functionality of the I2C bus and contain 2.2k pull-up resistors.
:*Porty '''GPIO 1''' oraz '''GPIO 3''' pełnią funkcję interfejsu UART i zostały połączone do modułu konwertera USB-UART oraz równolegle do złącza GPIO J1. Interfejs UART wysyła/odczytuje dane do/z złącza GPIO J2 oraz konwertera USB-UART jednocześnie.
:*Ports '''GPIO 1''' and '''GPIO 3''' act as a UART interface and are connected to the USB-UART converter module and in parallel to the GPIO J1 connector. The UART interface sends/reads data to/from the GPIO J2 connector and the USB-UART converter simultaneously.
:*Porty '''GPIO5''', '''GPIO12''' oraz '''GPIO15''' konfigurują pewne parametry modułu ESP32. Ich stan jest odczytywany w momencie uruchomienia (restartu) modułu ESP32, dlatego zostały wyposażone w rezystory podciągające:GPIO5 – pull-up, GPIO12 – pull-down, GPIO15 – pull-down. Należy zadbać o to, aby poziom logiczny na tych wyprowadzeniach w momencie uruchomienia (restartu), odpowiadał stanowi wymuszonemu rezystorami pull-up/down.
:*Ports '''GPIO5''', '''GPIO12''' and '''GPIO15''' configure certain parameters of the ESP32 module. Their state is read at the moment of starting (restarting) the ESP32 module, which is why they are equipped with pull-up resistors: GPIO5 – pull-up, GPIO12 – pull-down, GPIO15 – pull-down. It is necessary to ensure that the logical level on these pins at the moment of starting (restarting) corresponds to the state forced by the pull-up/down resistors.
:*Port '''GPIO16''' został połączony z sygnałem zerującym driver Ethernet układ LAN8742. Stan niski na tym wyprowadzeniu blokuje działanie interfejsu Ethernet.
:*Port '''GPIO16''' has been connected to the Ethernet driver reset signal – LAN8742 system. Low state on this pin blocks the operation of the Ethernet interface.
<br><br>
<br><br>


===== Funkcje zaawansowane =====
===== Advanced Features =====
<center>
<center>
{| class="wikitable" style="width: 800px;"
{| class="wikitable" style="width: 800px;"
|-
|-
! style="text-align: center;"|Komponent
! style="text-align: center;"|Component
! style="text-align: center;"|Funkcja
! style="text-align: center;"|Function
|-
|-
| style="text-align: center;"|'''JP1 – ETH RST IO16'''
| style="text-align: center;"|'''JP1 – ETH RST IO16'''
| style="text-align: left;"|
| style="text-align: left;"|
:* Zworka SMD, fabrycznie zwarta, stanowi połączenie portu GPIO16 z sygnałem zerowania drivera Ethernet
:* The SMD jumper, factory-closed, connects the GPIO16 port to the Ethernet driver reset signal
|-
|-
| style="text-align: center;"|'''JP3 – DBG INFO EN'''
| style="text-align: center;"|'''JP3 – DBG INFO EN'''
| style="text-align: left;"|
| style="text-align: left;"|
:* Zworka SMD, pozwala włączyć wysyłanie komunikatów systemowych – Debugging Log, poprzez interfejs UART (USB)
:* SMD jumper, allows you to enable sending system messages – Debugging Log, via UART (USB) interface
|}
|}
</center>
</center>
Zworki JP1 oraz JP3 znajdują się na dolnej stronie płytki ewaluacyjnej (bottom).<br><br>
Jumpers JP1 and JP3 are located on the bottom side of the evaluation board.<br><br>
'''JP1 – ETH RST IO16''' jest fabrycznie zwarta (ścieżka miedzi pomiędzy padami) i zapewnia połączenie pomiędzy portem GPIO16 modułu ESP32 i wejściem RESET drivera interfejsu Ethernet. Aby odłączyć port GPIO16 od sygnału zerowania drivera Ethernet należy przeciąć ostrym narzędziem powierzchnię płytki tak jak wskazuje czerwona linia przy JP1 na poniższym rysunku. Ponowne połączenie sygnału zerowania jest możliwe poprzez naniesienie kropelki spoiwa lutowniczego, które połączy oba pady zworki JP1.<br><br>
'''JP1 – ETH RST IO16''' is factory-shorted (copper path between pads) and provides a connection between the GPIO16 port of the ESP32 module and the RESET input of the Ethernet interface driver. To disconnect the GPIO16 port from the Ethernet driver reset signal, cut the surface of the board with a sharp tool as indicated by the red line at JP1 in the drawing below. Reconnecting the reset signal is possible by applying a drop of solder, which will connect both pads of the JP1 jumper.<br><br>
'''JP3 DBG INFO EN''' jest fabrycznie połączona pomiędzy padem środkowym a padem numer 1 (masa zasilania) i powoduje wyciszenie komunikatów systemowych tzw. Debugging Log. Aby włączyć wysyłanie komunikatów systemowych należy przeciąć ostrym narzędziem powierzchnię płytki tak, jak wskazuje czerwona linia przy JP3 na poniższym rysunku oraz nanieść kroplę spoiwa lutowniczego, które połączy pady po przeciwnej stronie, pady 2-3 (do napięcia 3,3 V).
'''JP3 - DBG INFO EN''' is factory connected between the middle pad and pad number 1 (power supply ground) and causes the system messages, so-called Debugging Log, to be silenced. To enable sending system messages, cut the surface of the board with a sharp tool as indicated by the red line at JP3 in the drawing below and apply a drop of solder, which will connect the pads on the opposite side, pads 2-3 (up to a voltage of 3.3 V).
Nie wolno połączyć padów 2-3, bez wcześniejszego rozdzielenia padów 1-2.<br><br>
It is not allowed to connect pads 2-3 without first separating pads 1-2.<br><br>
<center>
<center>
[[File:KAmodESP32-POE_func.png|none|600px|thumb|center]]
[[File:KAmodESP32-POE_func.png|none|600px|thumb|center]]
</center>
</center>


===== Wymiary =====
===== Dimensions =====
Wymiary płytki KAmod ESP32 ETH+POE to 85x56 mm. Wysokość maksymalna wynosi ok. 20 mm. Na płytce znajdują się 4 otwory montażowe o średnicy 3 mm rozmieszczone podobnie jak na płytkach z rodziny Raspberry Pi.
The dimensions of the KAmod ESP32 ETH+POE board are 85x56 mm. The maximum height is about 20 mm. The board has 4 mounting holes with a diameter of 3 mm, arranged similarly to the Raspberry Pi family boards.
<center>
<center>
[[File:KAmodESP32-POE_wym.png|none|800px|thumb|center]]
[[File:KAmodESP32-POE_wym.png|none|800px|thumb|center]]
Line 369: Line 368:
<br><br>
<br><br>


===== Program testowy =====
===== Test program =====
Kod programu testowego znajduje się poniżej, można go skompilować w środowisku Arduino.
The test program code is below, it can be compiled in the Arduino environment.
<br><br>
<br><br>
<syntaxhighlight lang="arduino">
<syntaxhighlight lang="arduino">
Line 534: Line 533:
</syntaxhighlight>
</syntaxhighlight>
<br><br>
<br><br>
Program testowy konfiguruje port GPIO2 jako wyjście sterujące diodą LED (D6) i sygnalizuje rozpoczęcie działania kilkoma mignięciami. Następnie uruchamia sprzętowy interfejs UART i konfiguruje go do pracy jako interfejs szeregowy połączony do konwertera UART-USB. Dzięki temu można monitorować działanie płytki w dowolnym programie typu terminal (Serial Monitor).
The test program configures the GPIO2 port as an output driving the LED (D6) and signals the start of operation with a few blinks. Then it starts the hardware UART interface and configures it to work as a serial interface connected to the UART-USB converter. Thanks to this, you can monitor the board's operation in any terminal program (Serial Monitor).
<br><br>
<br><br>
<syntaxhighlight lang="arduino">
<syntaxhighlight lang="arduino">
Line 549: Line 548:
</syntaxhighlight>
</syntaxhighlight>
<br><br>
<br><br>
Przygotowanie do pracy drivera interfejsu Ethernet – układu LAN8742, wymaga dołączenia biblioteki ETH.h oraz zdefiniowania funkcji wyprowadzeń. Układ LAN8742 jest kompatybilny z układem LAN8720, który z kolei jest wspierany w środowisku Arduino.
Preparing the Ethernet interface driver – LAN8742 system, requires adding the ETH.h library and defining the pin functions. The LAN8742 system is compatible with the LAN8720 system, which in turn is supported in the Arduino environment.
<br><br>
<br><br>
<syntaxhighlight lang="arduino">
<syntaxhighlight lang="arduino">
Line 583: Line 582:
</syntaxhighlight>
</syntaxhighlight>
<br><br>
<br><br>
Teraz można uruchomić interfejs oraz serwer www:
Now you can start the interface and the web server:
<br><br>
<br><br>
<syntaxhighlight lang="arduino">
<syntaxhighlight lang="arduino">
Line 595: Line 594:
</syntaxhighlight>
</syntaxhighlight>
<br><br>
<br><br>
Po uruchomieniu programu testowego zostanie uruchomiony serwer www z bardzo prostą stroną internetową, która umożliwia sterowanie diodą LED D6 oraz wysłanie komunikatu poprzez port szeregowy:
After starting the test program, the www server will be launched with a very simple website that allows you to control the D6 LED and send a message via the serial port:
<center>
<center>
[[File:KAmodESP32-POE_www.jpg|none|1000px|thumb|center]]
[[File:KAmodESP32-POE_www.jpg|none|1000px|thumb|center]]
</center>
</center>


Adres IP, który zostanie przydzielony serwerowi www w sieci LAN można odczytać z komunikatów wysyłanych przez port szeregowy:
The IP address that will be assigned to the www server in the LAN can be read from the messages sent via the serial port:
<br>
<br>
<center>
<center>
Line 606: Line 605:
</center>
</center>
<br><br>
<br><br>
Adres IP można również określić w programie, należy wtedy określić cztery parametry:
The IP address can also be specified in the program, then you need to specify four parameters:
<br><br>
<br><br>
<syntaxhighlight lang="arduino">
<syntaxhighlight lang="arduino">
Line 615: Line 614:
</syntaxhighlight>
</syntaxhighlight>
<br><br>
<br><br>
a następnie wpisać polecenie:
and then enter the command:
<br><br>
<br><br>
<syntaxhighlight lang="arduino">
<syntaxhighlight lang="arduino">
Line 621: Line 620:
</syntaxhighlight>
</syntaxhighlight>
<br><br>
<br><br>
przed linią:
before the line:
<br><br>
<br><br>
<syntaxhighlight lang="arduino">
<syntaxhighlight lang="arduino">
Line 628: Line 627:
<br><br>
<br><br>


===== Linki =====
===== Links =====
*[https://wiki.kamamilabs.com/images/f/f4/DS_LAN8742_00001989A.pdf Karta katalogowa układu LAN8742]
*[https://wiki.kamamilabs.com/images/f/f4/DS_LAN8742_00001989A.pdf LAN8742 datasheet]
*[https://wiki.kamamilabs.com/images/3/30/MP8007.pdf Karta katalogowa układu MP8007]
*[https://wiki.kamamilabs.com/images/3/30/MP8007.pdf MP8007 datasheet]
*[https://download.kamami.pl/p1179653-esp32-wroom-32d_esp32-wroom-32u_datasheet_en.pdf Karta katalogowa układu ESP32]
*[https://download.kamami.pl/p1179653-esp32-wroom-32d_esp32-wroom-32u_datasheet_en.pdf ESP32 datasheet]
*[https://wiki.kamamilabs.com/images/2/29/CH340DS1.PDF Karta katalogowa układu CH340]
*[https://wiki.kamamilabs.com/images/2/29/CH340DS1.PDF Datasheet CH340]
*[https://download.kamami.pl/p103134-st1s10.pdf Karta katalogowa układu ST1S10]
*[https://download.kamami.pl/p103134-st1s10.pdf Catalog card of the ST1S10 system]
*[https://wiki.kamamilabs.com/images/5/5d/Ardu_kamod_esp32_poe_lib_eth.zip Program testowy Arduino]
*[https://wiki.kamamilabs.com/images/5/5d/Ardu_kamod_esp32_poe_lib_eth.zip Arduino test program]

Latest revision as of 14:49, 15 January 2025

Description

KAmodESP32 ETH POE - Evaluation board with ESP32-WROOM module connected to Ethernet interface and PoE power supply system

The KAmod ESP32 ETH+POE board contains ESP32-WROOM module enabling communication in 2.4 GHz Wi-Fi wireless network, however it has been connected to Ethernet wired interface with typical RJ45 connector. Programming ESP32 module is possible with USB-UART converter with USB-C connector. The board is complemented by PoE power supply system - Power over Ethernet, thanks to which power supply of the module can be supplied from internet installation. The board design corresponds to SBC of Raspberry Pi family - it has dimensions 81x56 mm, and on characteristic 40-pin connector all important I/O ports and supply voltages 5 V and 3.3 V, which can power additional components connected to the board, have been led out.

Basic features and parameters
  • ESP32-WROOM module enabling communication in a Wi-Fi network in the 2.4 GHz band
  • Ethernet interface based on the LAN8742 system (100/10 M; full/half duplex)
  • Integrated UART-USB converter with USB-C connector enabling programming of the ESP32 system
  • PoE power supply system, compatible with the IEEE 802.3af/at Class 0 standard
  • Provides stabilized voltages of 5 V (+/-10%) and 3.3 V (+/-5%) with a total current of up to 1.5 A
  • Overvoltage, overload and thermal protection
  • All important I/O ports and supply voltages have been led out to the 40-pin connector in the Raspberry Pi standard
  • Board dimensions: 85x56 mm, height approx. 20 mm



Standard Equipment
Code Description
KAmodESP32 ETH+POE Assembled and launched module



Electrical diagram

ESP32 module


Elements responsible for reset and programming functions

GPIO connector

Indicator diodes

Ethernet interface

PoE power supply

USB-UART interface

Source of the clocking signal

3.3V power block

Ethernet Interface
Connector Function
J2 – ETH & PoE

(RJ45)

  • Allows cable connection to the Internet


The KAmod ESP32 ETH+POE board implements a wired Ethernet interface with a classic RJ45 socket (J2). The LAN8742 chip, which is compatible with LAN8720 and supported in the Arduino environment, is used as the driver (PHY) of the Ethernet interface. It can operate at 100 Mb or 10 Mb in Full-Duplex or Half-Duplex mode.

The Ethernet driver is connected to the ESP32 module via the RMII interface (Reduced media-independent interface). The signal assignment is described in the table:

RMII Signal Direction ESP32 Module Pinout

TXD0

<-

GPIO19

TXD1

<-

GPIO22

TXEN

<-

GPIO21

RXD0

->

GPIO25

RXD1

->

GPIO26

CRS_DV

->

GPIO27

MDIO

<->

GPIO18

MDC

<-

GPIO23

REF_CLK

->

GPIO0

RESET

<-

GPIO16


Power by PoE
Connector Function
J2 – ETH & PoE

(RJ45)

  • Receives power from PoE installation

The ETH & PoE connector (J2) can be used to supply power to the evaluation board. The PoE power controller used is based on the MP8007 system, which is compatible with the IEEE 802.3af - Powered Devices Type-1 and IEEE 802.3at - Powered Devices Type-2 standards. The PoE power block is configured to operate in Class 0, which defines the device's power consumption in the range of 0.5...13 W.

Power supply using the PoE method is only possible in a compatible installation containing a PSE (Power Sourcing Equipments) device that meets the IEEE 802.3af/at standard, e.g. a PoE router. The correct operation of the PoE power block is indicated by the lighting of the POE diode (D4). During the operation of the PoE power supply unit, noise or a quiet squeak may be heard - this is a natural phenomenon caused by the operation of the switching power supply (SMPS).

When the KAmod ESP32 ETH+POE evaluation board is properly powered, stabilized voltages of approx. 5 V and 3.3 V are generated, available on the J1 pin connector. They can be used to power other modules connected to the evaluation board, but remember that the total current should not exceed 1.5 A.

In the PoE installation, voltages with values ​​​​of up to 60 V occur. All activities performed in such installations using the KAmod ESP32 ETH+POE evaluation board should be performed with special caution and in compliance with safety rules.



USB Interface
Connector Function
P1 – COM&POW

(USB-C)

  • Performs the function of a USB-UART converter
  • Allows programming of the ESP32 module
  • Is an alternative power input

The P1 USB-C connector is connected to the CH340 type controller, which performs the functions of a USB-UART converter. The UART interface can be used in the target application, but it is also used to program the ESP32 module. The programming process can be completely automatic, because the CH340 controller controls the key pins of the ESP32 module (GPIO0 - Boot Select and EN - Chip Power-up).

The signal connections between CH340 and ESP32 are as follows:

CH340 controller signal ESP32 module pinout
TXD (data output) GPIO03 (UART0 RXD)
RXD (data input) GPIO01 (UART0 TXD)
DTR (transmission control output) EN (Chip Power-up)
RTS (transmission control output) GPIO0 (Boot Select)

The TXD line is connected to an LED marked USB (D3), which signals the reception of data from the USB interface. If a USB-UART converter is used in the target application, it is necessary to ensure that the DTR and RTS lines remain unsupported (Handshaking: None).

The USB-C connector can be used as an alternative power input for the KAmod ESP32 ETH+POE board, but then the parameters of the power supply circuits will not be met. The voltage on the 5 V line will be lower and will be around 4.5 V; the voltage on the 3.3 V line should not change; the current efficiency of the 5 V and 3.3 V voltages may be much lower and will depend on the power supply used on the USB-C connector.



Reset and Programming Buttons
Component Function
SW1 Button – PROG
  • Starts programming mode via UART (only when the ESP32 module is restarted)
SW2 Button – RESET
  • Restarts the ESP32 module and the Ethernet interface controller

The RESET button allows you to restart the ESP32 module and, at the same time, the Ethernet interface controller. It is connected to the EN (Chip Power-up) line of the ESP32 module.

The PROG button allows you to enter the ESP32 module into programming mode. Then you should press the RESET button, then, while holding RESET, hold the PROG button and then release RESET, while still holding PROG for a moment. This functionality can be useful when for some reason the programming mode is not started automatically via the USB-UART converter.



Signal lights
Component Function
D3 – USB
  • D3 LED flashing means data is being transferred from USB to the ESP32 module
D4 – POE
  • D4 LED lighting means the PoE power supply module is working properly
D5 – POW
  • The D5 diode lighting up indicates the presence of the main supply voltage - voltage 3.3 V
D6 – IO-2
  • The D6 diode is connected to the GPIO2 pin of the ESP32 module and its lighting up can be controlled by software

There are 4 LEDs on the KAmod ESP32 ETH+POE board, which signal the operation of various components - according to the table above.

The D6 diode (LED IO-2) is connected to the GPIO2 pin of the ESP32 module. Its lighting up requires a programmatic setting of the high state on the GPIO2 pin.

The additional two signaling diodes are located on the J2 connector. The diode on the left (POWER) indicates the presence of the main supply voltage - voltage 3.3 V. The diode on the right (LINK) flashes to indicate the activity of the Ethernet interface.



GPIO connector in RPi standard
Connector Function
J1 – Goldpin 2x20
  • Raspberry Pi standard connector
  • Some GPIO ports of the ESP32 module brought out
  • 5 V, 3.3 V, GND power lines brought out

The Raspberry Pi standard GPIO connector (J1) contains 40 pins, to which the 5 V, 3.3 V, GND power lines and some GPIO pins of the ESP32 module are brought out. The UART (TXD, RXD), I2C (SDA, SCL) and SPI (MOSI, MISO, SCLK, CS0) interface pins have been arranged as they are in the Raspberry Pi family boards.

A detailed description of the pins and their functions is shown in the figure and table below:

The description of the pins has also been marked on the bottom of the KAmod ESP32 board ETH+POE:

Notes on signals output to GPIO connector

  • Ports GPIO 34, 35, 36 and 39 of the ESP32 module can only work as digital or analog inputs - they are marked with the symbol IN.
  • Ports GPIO 34 and 35 are equipped with 10k pull-up resistors.
  • Ports GPIO 36 and 39 are equipped with voltage dividers (100k/10k), thanks to which a maximum voltage of 35 V can be connected to them.
  • Ports GPIO 32 and 33 are adapted to the functionality of the I2C bus and contain 2.2k pull-up resistors.
  • Ports GPIO 1 and GPIO 3 act as a UART interface and are connected to the USB-UART converter module and in parallel to the GPIO J1 connector. The UART interface sends/reads data to/from the GPIO J2 connector and the USB-UART converter simultaneously.
  • Ports GPIO5, GPIO12 and GPIO15 configure certain parameters of the ESP32 module. Their state is read at the moment of starting (restarting) the ESP32 module, which is why they are equipped with pull-up resistors: GPIO5 – pull-up, GPIO12 – pull-down, GPIO15 – pull-down. It is necessary to ensure that the logical level on these pins at the moment of starting (restarting) corresponds to the state forced by the pull-up/down resistors.
  • Port GPIO16 has been connected to the Ethernet driver reset signal – LAN8742 system. Low state on this pin blocks the operation of the Ethernet interface.



Advanced Features
Component Function
JP1 – ETH RST IO16
  • The SMD jumper, factory-closed, connects the GPIO16 port to the Ethernet driver reset signal
JP3 – DBG INFO EN
  • SMD jumper, allows you to enable sending system messages – Debugging Log, via UART (USB) interface

Jumpers JP1 and JP3 are located on the bottom side of the evaluation board.

JP1 – ETH RST IO16 is factory-shorted (copper path between pads) and provides a connection between the GPIO16 port of the ESP32 module and the RESET input of the Ethernet interface driver. To disconnect the GPIO16 port from the Ethernet driver reset signal, cut the surface of the board with a sharp tool – as indicated by the red line at JP1 in the drawing below. Reconnecting the reset signal is possible by applying a drop of solder, which will connect both pads of the JP1 jumper.

JP3 - DBG INFO EN is factory connected between the middle pad and pad number 1 (power supply ground) and causes the system messages, so-called Debugging Log, to be silenced. To enable sending system messages, cut the surface of the board with a sharp tool as indicated by the red line at JP3 in the drawing below and apply a drop of solder, which will connect the pads on the opposite side, pads 2-3 (up to a voltage of 3.3 V). It is not allowed to connect pads 2-3 without first separating pads 1-2.

Dimensions

The dimensions of the KAmod ESP32 ETH+POE board are 85x56 mm. The maximum height is about 20 mm. The board has 4 mounting holes with a diameter of 3 mm, arranged similarly to the Raspberry Pi family boards.



Test program

The test program code is below, it can be compiled in the Arduino environment.

#include <ETH.h>
#include <WiFi.h>
/* 
   * ETH_CLOCK_GPIO0_IN   - default: external clock from crystal oscillator
   * ETH_CLOCK_GPIO0_OUT  - 50MHz clock from internal APLL on GPIO0
   * ETH_CLOCK_GPIO16_OUT - 50MHz clock from internal APLL on GPIO16
   * ETH_CLOCK_GPIO17_OUT - 50MHz clock from internal APLL inverted on GPIO17
*/
#ifdef ETH_CLK_MODE
  #undef ETH_CLK_MODE
#endif
#define ETH_CLK_MODE    ETH_CLOCK_GPIO0_IN
// Pin# of the enable signal for the external crystal oscillator (-1 to disable for internal APLL source)
#define ETH_POWER_PIN   -1
// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE        ETH_PHY_LAN8720
// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR        0
// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN     23
// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN    18

#define ETH_RESET     16

#define LED_PIN       2

static bool eth_connected = false;

WiFiServer server(80);

// Select the IP address according to your local network
IPAddress myIP(10, 1, 0, 182);
IPAddress myGW(10, 1, 0, 252);
IPAddress mySN(255, 255, 0, 0);
IPAddress myDNS(8, 8, 8, 8);

void myEvent(WiFiEvent_t event) {
  switch (event) {
    case ARDUINO_EVENT_ETH_START:
      Serial.println("ETH Started");
      ETH.setHostname("esp32-ethernet");
      break;
    case ARDUINO_EVENT_ETH_CONNECTED:
      Serial.println("ETH Connected");
      break;
    case ARDUINO_EVENT_ETH_GOT_IP:
      //Serial.println("ETH Got IP");
      //Serial.println(ETH);
      Serial.print("ETH MAC: ");
      Serial.print(ETH.macAddress());
      Serial.print(", IPv4: ");
      Serial.print(ETH.localIP());
      if (ETH.fullDuplex()) {
        Serial.print(", FULL_DUPLEX");
      }
      Serial.print(", ");
      Serial.print(ETH.linkSpeed());
      Serial.println("Mbps");
      eth_connected = true;
      break;
    case ARDUINO_EVENT_ETH_LOST_IP:
      Serial.println("ETH Lost IP");
      eth_connected = false;
      break;
    case ARDUINO_EVENT_ETH_DISCONNECTED:
      Serial.println("ETH Disconnected");
      eth_connected = false;
      break;
    case ARDUINO_EVENT_ETH_STOP:
      Serial.println("ETH Stopped");
      eth_connected = false;
      break;
    default:
      break;
  }
}

void setup() {
  //ETH Reset assert
  pinMode(ETH_RESET, OUTPUT);
  digitalWrite(ETH_RESET, LOW);

  pinMode(LED_PIN, OUTPUT);
  for(int i=0; i<5; i++){
    digitalWrite(LED_PIN, HIGH);
    delay(200);
    digitalWrite(LED_PIN, LOW);
    delay(200);
  }

  //ETH Reset deassert
  digitalWrite(ETH_RESET, HIGH);
  delay(200);

  //Serial - start
  Serial.begin(115200);

  WiFi.onEvent(myEvent);
  ETH.begin(ETH_TYPE, ETH_ADDR,
            ETH_MDC_PIN, ETH_MDIO_PIN,
            ETH_POWER_PIN, ETH_CLK_MODE);
  //ETH.config(myIP, myGW, mySN, myDNS);

  while (!ETH.connected()){}
  server.begin();
}

void loop() {
  // listen for incoming clients
  WiFiClient client = server.available();

  if (client) {
    Serial.println("********New Client********");

    String currentLine = "";

    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        //Serial.write(c);
        if (c == '\n') {

          if (currentLine.length() == 0) {
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();
            client.print("<H2>Click <a href=\"/H\">here</a> to turn ON the LED.<br>");
            client.print("Click <a href=\"/L\">here</a> to turn OFF the LED.<br>");
            client.print("Click <a href=\"/SEND\">here</a> to write to Serial (USB).<br></H2>");
            client.println();
            break;
          } else {
            currentLine = "";
          }
        } else if (c != '\r') {
          currentLine += c;
        }

        //if (currentLine.endsWith("GET /H")) {
        if (currentLine.indexOf("GET /H") >= 0) {
          digitalWrite(LED_PIN, HIGH);
        }
        //if (currentLine.endsWith("GET /L")) {
        if (currentLine.indexOf("GET /L") >= 0) {
          digitalWrite(LED_PIN, LOW);
        }
        if (currentLine.endsWith("GET /SEND")) {
          Serial.println("\r\nHELLO - you send message via Serial(USB)");
        }
      }
    }

    delay(10);
    client.stop();
    Serial.println("********Client Disconnected********");
  }
}



The test program configures the GPIO2 port as an output driving the LED (D6) and signals the start of operation with a few blinks. Then it starts the hardware UART interface and configures it to work as a serial interface connected to the UART-USB converter. Thanks to this, you can monitor the board's operation in any terminal program (Serial Monitor).

#define LED_PIN 2
pinMode(LED_PIN, OUTPUT);
for(int i=0; i<5; i++){
digitalWrite(LED_PIN, HIGH);
delay(200);
digitalWrite(LED_PIN, LOW);
delay(200);
}
//Serial - start
Serial.begin(115200);



Preparing the Ethernet interface driver – LAN8742 system, requires adding the ETH.h library and defining the pin functions. The LAN8742 system is compatible with the LAN8720 system, which in turn is supported in the Arduino environment.

#include <ETH.h>
/*
* ETH_CLOCK_GPIO0_IN - default: external clock from crystal oscillator
* ETH_CLOCK_GPIO0_OUT - 50MHz clock from internal APLL on GPIO0
* ETH_CLOCK_GPIO16_OUT - 50MHz clock from internal APLL on GPIO16
* ETH_CLOCK_GPIO17_OUT - 50MHz clock from internal APLL inverted on GPIO17
*/
#ifdef ETH_CLK_MODE
#undef ETH_CLK_MODE
#endif
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
// Pin# of the enable signal for the external crystal oscillator (-1 to disable for internal APLL source)
#define ETH_POWER_PIN -1
// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE ETH_PHY_LAN8720
// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR 0
// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN 23
// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN 18
#define ETH_RESET 16
//ETH Reset assert
pinMode(ETH_RESET, OUTPUT);
digitalWrite(ETH_RESET, LOW);
...
//ETH Reset deassert
digitalWrite(ETH_RESET, HIGH);
delay(200);



Now you can start the interface and the web server:

WiFiServer server(80);
ETH.begin(ETH_TYPE, ETH_ADDR,
ETH_MDC_PIN, ETH_MDIO_PIN,
ETH_POWER_PIN, ETH_CLK_MODE);
...
while (!ETH.connected()){}
server.begin();



After starting the test program, the www server will be launched with a very simple website that allows you to control the D6 LED and send a message via the serial port:

The IP address that will be assigned to the www server in the LAN can be read from the messages sent via the serial port:



The IP address can also be specified in the program, then you need to specify four parameters:

IPAddress myIP(10, 1, 0, 182);
IPAddress myGW(10, 1, 0, 252);
IPAddress mySN(255, 255, 0, 0);
IPAddress myDNS(8, 8, 8, 8);



and then enter the command:

ETH.config(myIP, myGW, mySN, myDNS);



before the line:

server.begin();



Links