No RMII Traffic Despite Properly Configured PHY
Posted: Sat Jul 15, 2023 9:35 pm
Hello all,
I am working on a custom board based on the ESP32-PICO-D4 SOC. Unfortunately, I am having a devil of a time getting the RMII link to function. Specifically, I see the PHY (KSZ8081) initialize correctly and output a 50MHz reference clock on REF_CLK but the EMACCSTATUS_REG register never shows a valid speed or duplex (always stuck at 2.5MHz/half).
Some things I have checked:
I added some debug prints to my custom command so I can dump a couple of key registers on command. Everything seems to be configured correctly EXCEPT that, as mentioned above, EMACCSTATUS_REG is always 0x00000000. This sure seems to indicate that the MAC hasn't properly configured the input clock. A sample of these registers is below:
Also please see Ethernet init code in attached sources. Waveforms and schematics available upon request.
So, in short, can anybody see what I am doing wrong? Are there any other registers or functions I can call to get additional information about the system?
Thanks in advance!
I am working on a custom board based on the ESP32-PICO-D4 SOC. Unfortunately, I am having a devil of a time getting the RMII link to function. Specifically, I see the PHY (KSZ8081) initialize correctly and output a 50MHz reference clock on REF_CLK but the EMACCSTATUS_REG register never shows a valid speed or duplex (always stuck at 2.5MHz/half).
Some things I have checked:
- The MDI-side link initializes correctly and autonegotiates with my Ethernet switch.
- The MDIO/SMI interface is functional and I am able to read/write/dump registers via a custom command.
- The PHY is correctly outputting a 50MHz sinusoidal waveform (via attached 25MHz crystal). If I intentionally misconfigure the PHY clock then this waveform halts.
- REF_CLK from the PHY is connected to GPIO 0, which is the only GPIO which supports clock input.
- The MAC is configured with:
Code: Select all
#define ETHERNET_PHY_TXCLK_GPIO 0 interface = EMAC_DATA_INTERFACE_RMII clock_config.rmii.clock_mode = EMAC_CLK_EXT_IN clock_config.rmii.clock_gpio = ETHERNET_PHY_TXCLK_GPIO
- A custom ping command I wrote shows no errors but no frames actually egress the device. I have added debug to LWIP and friends, this actually gets stuck at the first ARP request which is consistent with the MAC not passing traffic.
I added some debug prints to my custom command so I can dump a couple of key registers on command. Everything seems to be configured correctly EXCEPT that, as mentioned above, EMACCSTATUS_REG is always 0x00000000. This sure seems to indicate that the MAC hasn't properly configured the input clock. A sample of these registers is below:
Code: Select all
cmd_smi_do_read: EMACCONFIG_REG=0x0000CC0C, EMACDEBUG_REG=0x00000000
cmd_smi_do_read: EMACCSTATUS_REG=0x00000000, EMACWDOGTO_REG=0x00000000
cmd_smi_do_read: EMAC_EX_CLKOUT_CONF_REG=0x00000024, EMAC_EX_OSCCLK_CONF_REG=0x01001253, EMAC_EX_CLK_CTRL_REG=0x00000001
cmd_smi_do_read: EMAC_EX_PHYINF_CONF_REG=0x00008000, EMAC_PD_SEL_REG=0x00000000
So, in short, can anybody see what I am doing wrong? Are there any other registers or functions I can call to get additional information about the system?
Thanks in advance!