- RMII PHY wiring is fixed and can not be changed through either IOMUX or GPIO Matrix. By default, they're connected as follows:
GPIO | RMII Signal | Notes |
---|---|---|
GPIO21 | TX_EN | EMAC_TX_EN |
GPIO19 | TX0 | EMAC_TXD0 |
GPIO22 | TX1 | EMAC_TXD1 |
GPIO25 | RX0 | EMAC_RXD0 |
GPIO26 | RX1 | EMAC_RXD1 |
GPIO27 | CRS_DV | EMAC_RX_DRV |
GPIO0 | REF_CLK | EMAC_TX_CLK |
- SMI (Serial Management Interface) wiring is not fixed. You may need to changed it according to your board schematic. By default they're connected as follows:
GPIO | SMI Signal | Notes |
---|---|---|
GPIO23 | MDC | Output to PHY |
GPIO18 | MDIO | Bidirectional |
Because GPIO0 is a strapping pin for entering UART flashing mode on reset, care must be taken when also using this pin as EMAC_TX_CLK. If the clock output from the PHY is oscillating during reset, the ESP32 may randomly enter UART flashing mode.
One solution is to use an additional GPIO as a "power pin", which either powers the PHY on/off or enables/disables the PHY's own oscillator. This prevents the clock signal from being active during a system reset. For this configuration to work, GPIO0 also needs a pullup resistor and the "power pin" GPIO will need a pulldown resistor - as appropriate in order to keep the PHY clock disabled when the ESP32 is in reset.
See the example source code to see how the "power pin" GPIO can be managed in software.
The example defaults to using GPIO 5 for this function, but it can be overriden. On Espressif's Ethernet development board, GPIO 17 is the power pin used to enable/disable the PHY oscillator.
GPIO | Enable PHY Oscillator | Note |
---|---|---|
GPIO5 | PHY_OSC_ENABLE | Pull-down using a 10k resistor |