This section discusses the process for debugging the PHY.
- Step 1: Even after
initialization succeeds, PHY detection can fail if MDIO communication is not
working properly. The software must successfully read the PHY registers before
link establishment can occur.
- Set a breakpoint inside the EnetApp_getPhyAliveStatus() function called
during PHY detection. This function issues the ENET_MDIO_IOCTL_IS_ALIVE
IOCTL for each potential PHY address.
- Step through the loop and
examine the alive boolean output parameter after each iteration. If all
addresses return false, no PHYs are responding on the MDIO bus. This
response is potentially due to a software problem (MDIO clock frequency
configured incorrectly in SYSCFG) or hardware (broken traces, wrong
pullups on MDIO data lines). To prevent problems with hardware, refer to
the previous Hardware Debugging section.
- Step 2: If the
EnetApp_getPhyAliveStatus() function succeeds and detects the PHY, but
ENET_PER_IOCTL_OPEN_PORT_LINK still fails with ENET_ETIMEOUT, the problem is
likely in the register read operations of the PHY driver. The ENET-LLD reads the
PHY ID registers 0x02 and 0x03 to identify the device. If these reads timeout,
the MDIO timing is marginal.
- Check the MDIO clock
divider configuration in SYSCFG and verify the MCU produces a frequency
within the specified range (typically 1–2.5MHz) of the PHY. Setting the
frequency too low or high can cause setup or hold violations that
produce intermittent read failures.