1.. zephyr:board:: esp32_ethernet_kit 2 3Overview 4******** 5 6The ESP32-Ethernet-Kit is an Ethernet-to-Wi-Fi development board that enables 7Ethernet devices to be interconnected over Wi-Fi. At the same time, to provide 8more flexible power supply options, the ESP32-Ethernet-Kit also supports power 9over Ethernet (PoE). 10 11.. _get-started-esp32-ethernet-kit-v1.2-overview: 12 13ESP32-Ethernet-Kit is an ESP32-WROVER-E based development. 14For more information, check the datasheet at `ESP32-WROVER-E Datasheet`_. 15 16It consists of two development boards, the Ethernet Board A and the PoE 17board B. The `Ethernet Board (A)`_ contains Bluetooth/Wi-Fi dual-mode 18ESP32-WROVER-E module and IP101GRI, a Single Port 10/100 Fast Ethernet 19Transceiver (PHY). The `PoE Board (B)`_ provides power over Ethernet 20functionality. The A board can work independently, without the board B 21installed. 22 23.. _get-started-esp32-ethernet-kit-v1.2: 24 25.. figure:: img/esp32-ethernet-kit-v1.2.jpg 26 :align: center 27 :alt: ESP32-Ethernet-Kit V1.2 28 :figclass: align-center 29 30 ESP32-Ethernet-Kit V1.2 31 32For the application loading and monitoring, the Ethernet Board (A) also 33features FTDI FT2232H chip - an advanced multi-interface USB bridge. 34This chip enables to use JTAG for direct debugging of ESP32 through the 35USB interface without a separate JTAG debugger. 36 37 38Functionality Overview 39====================== 40 41The block diagram below shows the main components of ESP32-Ethernet-Kit 42and their interconnections. 43 44.. figure:: img/esp32-ethernet-kit-v1.1-block-diagram.jpg 45 :align: center 46 :alt: ESP32-Ethernet-Kit block diagram 47 :figclass: align-center 48 49 ESP32-Ethernet-Kit block diagram 50 51 52Functional Description 53---------------------- 54 55The following figures and tables describe the key components, interfaces, 56and controls of the ESP32-Ethernet-Kit. 57 58.. _get-started-esp32-ethernet-kit-a-v1.2-layout: 59 60 61Ethernet Board (A) 62^^^^^^^^^^^^^^^^^^ 63 64.. figure:: img/esp32-ethernet-kit-a-v1.2-layout.jpg 65 :align: center 66 :alt: ESP32-Ethernet-Kit V1.2 67 :figclass: align-center 68 69 ESP32-Ethernet-Kit - Ethernet Board (A) layout 70 71The table below provides description starting from the picture's top right 72corner and going clockwise. 73 74.. list-table:: Table 1 Component Description 75 :widths: 40 150 76 :header-rows: 1 77 78 * - Key Component 79 - Description 80 * - ESP32-WROVER-E 81 - This ESP32 module features 64-Mbit PSRAM for flexible extended storage 82 and data processing capabilities. 83 * - GPIO Header 2 84 - Five unpopulated through-hole solder pads to provide access to selected 85 GPIOs of ESP32. For details, see `GPIO Header 2`_. 86 * - Function Switch 87 - A 4-bit DIP switch used to configure the functionality of selected GPIOs 88 of ESP32. For details see `Function Switch`_. 89 * - Tx/Rx LEDs 90 - Two LEDs to show the status of UART transmission. 91 * - FT2232H 92 - The FT2232H chip serves as a multi-protocol USB-to-serial bridge which 93 can be programmed and controlled via USB to provide communication with 94 ESP32. FT2232H also features USB-to-JTAG interface which is available 95 on channel A of the chip, while USB-to-serial is on channel B. 96 The FT2232H chip enhances user-friendliness in terms of application 97 development and debugging. See `ESP32-Ethernet-Kit V1.2 Ethernet Board (A) Schematic`_ 98 * - USB Port 99 - USB interface. Power supply for the board as well as the communication 100 interface between a computer and the board. 101 * - Power Switch 102 - Power On/Off Switch. Toggling the switch to **5V0** position powers the 103 board on, toggling to **GND** position powers the board off. 104 * - 5V Input 105 - The 5 V power supply interface can be more convenient when the board is 106 operating autonomously (not connected to a computer). 107 * - 5V Power On LED 108 - This red LED turns on when power is supplied to the board, either from 109 USB or 5 V Input. 110 * - DC/DC Converter 111 - Provided DC 5 V to 3.3 V conversion, output current up to 2 A. 112 * - Board B Connectors 113 - A pair male and female header pins for mounting the `PoE Board (B)`_ 114 * - IP101GRI (PHY) 115 - The physical layer (PHY) connection to the Ethernet cable is 116 implemented using the 117 `IP101GRI <http://www.bdtic.com/DataSheet/ICplus/IP101G_DS_R01_20121224.pdf>`_ 118 chip. The connection between PHY and ESP32 is done through the reduced 119 media-independent interface (RMII), a variant of the media-independent 120 interface `(MII) <https://en.wikipedia.org/wiki/Media-independent_interface>`_ 121 standard. The PHY supports the IEEE 802.3/802.3u standard of 10/100 122 Mbps. 123 * - RJ45 Port 124 - Ethernet network data transmission port. 125 * - Magnetics Module 126 - The Magnetics are part of the Ethernet specification to protect against 127 faults and transients, including rejection of common mode signals 128 between the transceiver IC and the cable. The magnetics also provide 129 galvanic isolation between the transceiver and the Ethernet device. 130 * - Link/Activity LEDs 131 - Two LEDs (green and red) that respectively indicate the "Link" and 132 "Activity" statuses of the PHY. 133 * - BOOT Button 134 - Download button. Holding down **BOOT** and then pressing **EN** 135 initiates Firmware Download mode for downloading firmware through the 136 serial port. 137 * - EN Button 138 - Reset button. 139 * - GPIO Header 1 140 - This header provides six unpopulated through-hole solder pads connected 141 to spare GPIOs of ESP32. For details, see `GPIO Header 1`_. 142 143PoE Board (B) 144^^^^^^^^^^^^^ 145 146This board coverts power delivered over the Ethernet cable (PoE) to provide a 147power supply for the Ethernet Board (A). The main components of the PoE Board 148(B) are shown on the block diagram under `Functionality Overview`_. 149 150The PoE Board (B) has the following features: 151 152* Support for IEEE 802.3at 153* Power output: 5 V, 1.4 A 154 155To take advantage of the PoE functionality the **RJ45 Port** of the Ethernet 156board (A) should be connected with an Ethernet cable to a switch that supports 157PoE. When the Ethernet Board (A) detects 5 V power output from the PoE Board 158(B), the USB power will be automatically cut off. 159 160.. figure:: img/esp32-ethernet-kit-b-v1.0-layout.jpg 161 :align: center 162 :alt: ESP32-Ethernet-Kit - PoE Board (B) 163 :figclass: align-center 164 165 ESP32-Ethernet-Kit - PoE Board (B) layout 166 167.. list-table:: Table PoE Board (B) 168 :widths: 40 150 169 :header-rows: 1 170 171 * - Key Component 172 - Description 173 * - Board A Connector 174 - Four female (left) and four male (right) header pins for connecting the 175 PoE Board (B) to `Ethernet Board (A)`_. The pins on the left accept 176 power coming from a PoE switch. The pins on the right deliver 5 V power 177 supply to the Ethernet Board (A). 178 * - External Power Terminals 179 - Optional power supply (26.6 ~ 54 V) to the PoE Board (B). 180 181.. _get-started-esp32-ethernet-kit-v1.2-setup-options: 182 183 184Setup Options 185============= 186 187This section describes options to configure the ESP32-Ethernet-Kit hardware. 188 189 190Function Switch 191--------------- 192 193When in On position, this DIP switch is routing listed GPIOs to FT2232H to 194provide JTAG functionality. When in Off position, the GPIOs may be used for 195other purposes. 196 197======= ================ 198DIP SW GPIO Pin 199======= ================ 200 1 GPIO13 201 2 GPIO12 202 3 GPIO15 203 4 GPIO14 204======= ================ 205 206 207RMII Clock Selection 208-------------------- 209 210The ethernet MAC and PHY under RMII working mode need a common 50 MHz 211reference clock (i.e. RMII clock) that can be provided either externally, 212or generated from internal ESP32 APLL (not recommended). 213 214.. note:: 215 216 For additional information on the RMII clock selection, please refer to 217 `ESP32-Ethernet-Kit V1.2 Ethernet Board (A) Schematic`_, sheet 2, location D2. 218 219RMII Clock Sourced Externally by PHY 220^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 221 222By default, the ESP32-Ethernet-Kit is configured to provide RMII clock for the 223IP101GRI PHY's 50M_CLKO output. The clock signal is generated by the frequency 224multiplication of 25 MHz crystal connected to the PHY. For details, please see 225the figure below. 226 227.. figure:: img/esp32-ethernet-kit-rmii-clk-from-phy.jpg 228 :align: center 229 :alt: RMII Clock from IP101GRI PHY 230 :figclass: align-center 231 232 RMII Clock from IP101GRI PHY 233 234Please note that the PHY is reset on power up by pulling the RESET_N signal 235down with a resistor. ESP32 should assert RESET_N high with GPIO5 to enable 236PHY. Only this can ensure the power-up of system. Otherwise ESP32 may enter 237download mode (when the clock signal of REF_CLK_50M is at a high logic level 238during the GPIO0 power-up sampling phase). 239 240 241RMII Clock Sourced Internally from ESP32's APLL 242^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 243 244Another option is to source the RMII Clock from internal ESP32 APLL, see 245figure below. The clock signal coming from GPIO0 is first inverted, to account 246for transmission line delay, and then supplied to the PHY. 247 248.. figure:: img/esp32-ethernet-kit-rmii-clk-to-phy.jpg 249 :align: center 250 :alt: RMII Clock from ESP Internal APLL 251 :figclass: align-center 252 253 RMII Clock from ESP Internal APLL 254 255To implement this option, users need to remove or add some RC components on 256the board. For details please refer to 257`ESP32-Ethernet-Kit V1.2 Ethernet Board (A) Schematic`_, 258sheet 2, location D2. Please note that if the APLL is already used for other 259purposes (e.g. I2S peripheral), then you have no choice but use an external 260RMII clock. 261 262 263GPIO Allocation 264--------------- 265 266This section describes allocation of ESP32 GPIOs to specific interfaces or 267functions of the ESP32-Ethernet-Kit. 268 269 270IP101GRI (PHY) Interface 271^^^^^^^^^^^^^^^^^^^^^^^^ 272 273The allocation of the ESP32 (MAC) pins to IP101GRI (PHY) is shown in the table 274below. Implementation of ESP32-Ethernet-Kit defaults to Reduced 275Media-Independent Interface (RMII). 276 277==== ================ =============== 278No. ESP32 Pin (MAC) IP101GRI (PHY) 279==== ================ =============== 280*RMII Interface* 281--------------------------------------- 282 1 GPIO21 TX_EN 283 2 GPIO19 TXD[0] 284 3 GPIO22 TXD[1] 285 4 GPIO25 RXD[0] 286 5 GPIO26 RXD[1] 287 6 GPIO27 CRS_DV 288 7 GPIO0 REF_CLK 289---- ---------------- --------------- 290*Serial Management Interface* 291--------------------------------------- 292 8 GPIO23 MDC 293 9 GPIO18 MDIO 294---- ---------------- --------------- 295*PHY Reset* 296--------------------------------------- 29710 GPIO5 Reset_N 298==== ================ =============== 299 300.. note:: 301 302 The allocation of all pins under the ESP32's *RMII Interface* is fixed and 303 cannot be changed either through IO MUX or GPIO Matrix. REF_CLK can only 304 be selected from GPIO0, GPIO16 or GPIO17 and it can not be changed through 305 GPIO Matrix. 306 307 308GPIO Header 1 309^^^^^^^^^^^^^ 310 311This header exposes some GPIOs that are not used elsewhere on the 312ESP32-Ethernet-Kit. 313 314==== ================ 315No. ESP32 Pin 316==== ================ 317 1 GPIO32 318 2 GPIO33 319 3 GPIO34 320 4 GPIO35 321 5 GPIO36 322 6 GPIO39 323==== ================ 324 325 326GPIO Header 2 327^^^^^^^^^^^^^ 328 329This header contains GPIOs that may be used for other purposes depending on 330scenarios described in column "Comments". 331 332==== ========== ==================== 333No. ESP32 Pin Comments 334==== ========== ==================== 335 1 GPIO17 See note 1 336 2 GPIO16 See note 1 337 3 GPIO4 338 4 GPIO2 339 5 GPIO13 See note 2 340 6 GPIO12 See note 2 341 7 GPIO15 See note 2 342 8 GPIO14 See note 2 343 9 GND Ground 34410 3V3 3.3 V power supply 345==== ========== ==================== 346 347.. note:: 348 349 1. The ESP32 pins GPIO16 and GPIO17 are not broken out to the 350 ESP32-WROVER-E module and therefore not available for use. If you need 351 to use these pins, please solder a module without PSRAM memory inside, 352 e.g. the ESP32-WROOM-32D or ESP32-SOLO-1. 353 354 2. Functionality depends on the settings of the `Function Switch`_. 355 356 357GPIO Allocation Summary 358^^^^^^^^^^^^^^^^^^^^^^^ 359 360.. csv-table:: 361 :header: ESP32-WROVER-E,IP101GRI,UART,JTAG,GPIO,Comments 362 363 S_VP,,,,IO36, 364 S_VN,,,,IO39, 365 IO34,,,,IO34, 366 IO35,,,,IO35, 367 IO32,,,,IO32, 368 IO33,,,,IO33, 369 IO25,RXD[0],,,, 370 IO26,RXD[1],,,, 371 IO27,CRS_DV,,,, 372 IO14,,,TMS,IO14, 373 IO12,,,TDI,IO12, 374 IO13,,,TCK,IO13, 375 IO15,,,TDO,IO15, 376 IO2,,,,IO2, 377 IO0,REF_CLK,,,,See note 1 378 IO4,,,,IO4, 379 IO16,,,,IO16 (NC),See note 2 380 IO17,,,,IO17 (NC),See note 2 381 IO5,Reset_N,,,,See note 1 382 IO18,MDIO,,,, 383 IO19,TXD[0],,,, 384 IO21,TX_EN,,,, 385 RXD0,,RXD,,, 386 TXD0,,TXD,,, 387 IO22,TXD[1],,,, 388 IO23,MDC,,,, 389 390.. note:: 391 392 1. To prevent the power-on state of the GPIO0 from being affected by the 393 clock output on the PHY side, the RESET_N signal to PHY defaults to 394 low, turning the clock output off. After power-on you can control 395 RESET_N with GPIO5 to turn the clock output on. See also 396 `RMII Clock Sourced Externally by PHY`_. For PHYs that cannot turn off 397 the clock output through RESET_N, it is recommended to use a crystal 398 module that can be disabled/enabled externally. Similarly like when 399 using RESET_N, the oscillator module should be disabled by default and 400 turned on by ESP32 after power-up. For a reference design please see 401 `ESP32-Ethernet-Kit V1.2 Ethernet Board (A) Schematic`_. 402 403 2. The ESP32 pins GPIO16 and GPIO17 are not broken out to the 404 ESP32-WROVER-E module and therefore not available for use. If you need 405 to use these pins, please solder a module without PSRAM memory inside, 406 e.g. the ESP32-WROOM-32D or ESP32-SOLO-1. 407 408System requirements 409******************* 410 411Prerequisites 412============= 413 414Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command 415below to retrieve those files. 416 417.. code-block:: console 418 419 west blobs fetch hal_espressif 420 421.. note:: 422 423 It is recommended running the command above after :file:`west update`. 424 425Building & Flashing 426******************* 427 428Simple boot 429=========== 430 431The board could be loaded using the single binary image, without 2nd stage bootloader. 432It is the default option when building the application without additional configuration. 433 434.. note:: 435 436 Simple boot does not provide any security features nor OTA updates. 437 438MCUboot bootloader 439================== 440 441User may choose to use MCUboot bootloader instead. In that case the bootloader 442must be built (and flashed) at least once. 443 444There are two options to be used when building an application: 445 4461. Sysbuild 4472. Manual build 448 449.. note:: 450 451 User can select the MCUboot bootloader by adding the following line 452 to the board default configuration file. 453 454 .. code:: cfg 455 456 CONFIG_BOOTLOADER_MCUBOOT=y 457 458Sysbuild 459======== 460 461The sysbuild makes possible to build and flash all necessary images needed to 462bootstrap the board with the ESP32 SoC. 463 464To build the sample application using sysbuild use the command: 465 466.. zephyr-app-commands:: 467 :tool: west 468 :zephyr-app: samples/hello_world 469 :board: esp32_ethernet_kit/esp32/procpu 470 :goals: build 471 :west-args: --sysbuild 472 :compact: 473 474By default, the ESP32 sysbuild creates bootloader (MCUboot) and application 475images. But it can be configured to create other kind of images. 476 477Build directory structure created by sysbuild is different from traditional 478Zephyr build. Output is structured by the domain subdirectories: 479 480.. code-block:: 481 482 build/ 483 ├── hello_world 484 │ └── zephyr 485 │ ├── zephyr.elf 486 │ └── zephyr.bin 487 ├── mcuboot 488 │ └── zephyr 489 │ ├── zephyr.elf 490 │ └── zephyr.bin 491 └── domains.yaml 492 493.. note:: 494 495 With ``--sysbuild`` option the bootloader will be re-build and re-flash 496 every time the pristine build is used. 497 498For more information about the system build please read the :ref:`sysbuild` documentation. 499 500Manual build 501============ 502 503During the development cycle, it is intended to build & flash as quickly possible. 504For that reason, images can be built one at a time using traditional build. 505 506The instructions following are relevant for both manual build and sysbuild. 507The only difference is the structure of the build directory. 508 509.. note:: 510 511 Remember that bootloader (MCUboot) needs to be flash at least once. 512 513 514Build and flash applications as usual (see :ref:`build_an_application` and 515:ref:`application_run` for more details). 516 517.. zephyr-app-commands:: 518 :zephyr-app: samples/hello_world 519 :board: esp32_ethernet_kit/esp32/procpu 520 :goals: build 521 522The usual ``flash`` target will work with the ``esp32_ethernet_kit`` board 523configuration. Here is an example for the :zephyr:code-sample:`hello_world` 524application. 525 526.. zephyr-app-commands:: 527 :zephyr-app: samples/hello_world 528 :board: esp32_ethernet_kit/esp32/procpu 529 :goals: flash 530 531Open the serial monitor using the following command: 532 533.. code-block:: shell 534 535 west espressif monitor 536 537After the board has automatically reset and booted, you should see the following 538message in the monitor: 539 540.. code-block:: console 541 542 ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx ***** 543 Hello World! esp32_ethernet_kit 544 545Debugging 546********* 547 548As with much custom hardware, the ESP32 modules require patches to 549OpenOCD that are not upstreamed yet. Espressif maintains their own fork of 550the project. The custom OpenOCD can be obtained at `OpenOCD ESP32`_. 551 552The Zephyr SDK uses a bundled version of OpenOCD by default. You can overwrite that behavior by adding the 553``-DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>`` 554parameter when building. 555 556Here is an example for building the :zephyr:code-sample:`hello_world` application. 557 558.. zephyr-app-commands:: 559 :zephyr-app: samples/hello_world 560 :board: esp32_ethernet_kit/esp32/procpu 561 :goals: build flash 562 :gen-args: -DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts> 563 564You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application. 565 566.. zephyr-app-commands:: 567 :zephyr-app: samples/hello_world 568 :board: esp32_ethernet_kit/esp32/procpu 569 :goals: debug 570 571 572Enabling Ethernet 573***************** 574 575Enable Ethernet MAC, PHY and MDIO; add these to your device tree overlay: 576 577.. code-block:: devicetree 578 579 ð { 580 status = "okay"; 581 }; 582 583 &phy { 584 status = "okay"; 585 }; 586 587 &mdio { 588 status = "okay"; 589 }; 590 591Enable Ethernet in KConfig: 592 593.. code-block:: cfg 594 595 CONFIG_ETH_ESP32=y 596 CONFIG_NETWORKING=y 597 CONFIG_NET_L2_ETHERNET=y 598 599Board Init 600========== 601 602RESET_N (GPIO5) is automatically set high to enable the Ethernet PHY 603during board initialization (board_init.c) 604 605References 606********** 607 608.. target-notes:: 609 610.. _`ESP32-Ethernet-Kit V1.2 Ethernet Board (A) Schematic`: https://dl.espressif.com/dl/schematics/SCH_ESP32-Ethernet-Kit_A_V1.2_20200528.pdf 611.. _`ESP32-WROVER-E Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-wrover-e_esp32-wrover-ie_datasheet_en.pdf 612.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases 613