This section describes the sequence for initializing debugging.
Note:
The CPSW initialization sequence
involves multiple steps, each of which can fail silently if return codes are not
checked.
- Step 1: Initialization
failures prevent all subsequent operations, so start here first.
- Set the first breakpoint
at the Enet_open() function in the SYSCFG-generated code. This is
typically called from the EnetApp_driverOpen() function.
- Step through and capture
the return value when this breakpoint hits.
Note: If the
Enet_open() function returns NULL instead of a valid handle, the
initialization has failed.
Common causes of
failure include invalid clock configuration in SYSCFG, resource
allocation failure, or a mismatch between the peripheral
instance ID and what is available on your device.
- Step 2: The next critical checkpoint is the EnetApp_enableHostPort()
function.
- Set a breakpoint at the
EnetApp_enableHostPort() function and verify both IOCTL operations
return ENET_SOK.
Note: The first IOCTL sets
the ALE port state to forwarding mode
(CPSW_ALE_IOCTL_SET_PORT_STATE). If this fails with
ENET_EINVALIDPARAMS, the ALE configuration structure is corrupt or
was not properly initialized by SYSCFG.
The second IOCTL
(ENET_HOSTPORT_IOCTL_ENABLE) activates the individual host port.
Failure here typically means the Enet_open() function did not
complete successfully, even though the function returned a
non-NULL handle, which indicates internal resource
exhaustion.
- Step 3: After host port enablement, Each MAC port must be opened using
the EnetApp_enableMacPort() function.
- Set a breakpoint at the ENET_PER_IOCTL_OPEN_PORT_LINK IOCTL call and
examine the input structure.
- Verify the MAC interface
type (RGMII, RMII, MII) matches your hardware schematic.
Note: A common mistake is
configuring RGMII when the board uses RMII, which causes the MAC to
expect signals on pins that are not connected.
- Check the PHY address in
the configuration structure matches the hardware strapping.
Note: If this IOCTL returns
ENET_ETIMEOUT, the PHY is not responding on the MDIO bus at the
specified address, indicating either a wrong address configuration
or a hardware problem.
- Step 4: The final initialization checkpoint is DMA channel opening.
- Set breakpoints at the
EnetAppUtils_openTxCh() and EnetAppUtils_openRxCh() functions and verify
both return non-NULL channel handles.
Note: Check the MAC address
pool configuration in ti_enet_init.c if the EnetAppUtils_openRxCh()
function succeeds but the MAC address allocation step
fails.
Note: An exhausted address
pool prevents the application from obtaining addresses to add to the
ALE table, which silently breaks RX filtering.