SLUUDO2 September   2026 AM2611 , AM2612 , AM2612-Q1 , AM2631 , AM2631-Q1 , AM2632 , AM2632-Q1 , AM2634 , AM2634-Q1 , AM263P2 , AM263P2-Q1 , AM263P4 , AM263P4-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Acronyms
  5. 2Introduction
  6. 3Introduction to CPSWSS and ENET-LLD
    1. 3.1 Hardware
    2. 3.2 Software
    3. 3.3 Application Software
      1. 3.3.1 Board and Peripherals Initialization (SYSCFG)
      2. 3.3.2 CPSW Configuration (ENET-LLD)
      3. 3.3.3 Operating System (FreeRTOS or NoRTOS)
      4. 3.3.4 Middleware Stack (LwIP, Arm® Mbed™ Platform TLS, TSN)
      5. 3.3.5 Application Layer
  7. 4Debugging Hardware and Software
    1. 4.1 Hardware Debugging
      1. 4.1.1 Schematic Review Checklist
        1. 4.1.1.1 Management Data Input/Output (MDIO and MDC)
        2. 4.1.1.2 RGMII Interface
      2. 4.1.2 PHY Debug
        1. 4.1.2.1 PHY Bootstrap Settings
        2. 4.1.2.2 Trace Length
        3. 4.1.2.3 Clock Configuration
        4. 4.1.2.4 Mode Settings
        5. 4.1.2.5 IO MUX and SW Switch Settings
        6. 4.1.2.6 PHY Troubleshooting Guides
        7. 4.1.2.7 Custom Pin MUX Settings
      3. 4.1.3 Test Setup
      4. 4.1.4 Software Debugging
        1. 4.1.4.1 Using GEL Scripts in CCS
          1. 4.1.4.1.1 Statistics Using GEL Scripts
          2. 4.1.4.1.2 Statistics Using Expressions
      5. 4.1.5 Debugging Custom Ethernet Software
        1. 4.1.5.1 Debugging Initialization Sequence
        2. 4.1.5.2 PHY Debugging
        3. 4.1.5.3 MAC Port Debugging
        4. 4.1.5.4 TX Path Debugging
        5. 4.1.5.5 Systematic Debugging Checklist
          1. 4.1.5.5.1 RX Path Debugging
          2. 4.1.5.5.2 Multicast or Broadcast Does Not Work, But Unicast Works
    2. 4.2 Custom Hardware Bring-Up Process
      1. 4.2.1 Example 1: CPSW PHY Loopback
        1. 4.2.1.1 Failure: PHY Not Detected or MDIO Bus Not Alive
        2. 4.2.1.2 Failure: TX Packets Transmitted But RX Count = 0
      2. 4.2.2 Example 2: CPSW MAC Loopback Example
        1. 4.2.2.1 Failure: MAC Loopback Initialization Fails
        2. 4.2.2.2 Failure: TX Packets Increase But RX = 0
        3. 4.2.2.3 Failure: Nonzero Error Counters
      3. 4.2.3 Example 3: Enet_Layer2_CPSW and Enet_Layer2_cpsw_switch
        1. 4.2.3.1 Hardware Setup
        2. 4.2.3.2 Failure: Link Never Comes UP
        3. 4.2.3.3 Failure: Link is Up But No Frames Are Received or Transmitted
        4. 4.2.3.4 Failure: RX and TX Counters Increase But Error Rates Are High
      4. 4.2.4 Example 4: Enet_lwip_cpsw_example
        1. 4.2.4.1 Failure: Link Never Comes Up
        2. 4.2.4.2 Failure: Links Up But No IP Address Is Assigned
        3. 4.2.4.3 Failure: Ping Fails Despite Link and IP Address
    3. 4.3 Debugging Packet Forwarding Issues (ALE and Statistics)
      1. 4.3.1 CPSW Statistics Architecture
        1. 4.3.1.1 What Each Block Measures
        2. 4.3.1.2 Counter Reference Tables
          1. 4.3.1.2.1 MAC Port – RX Counters
          2. 4.3.1.2.2 MAC Port – TX Counters
          3. 4.3.1.2.3 MAC Port and Host Port – ALE and FIFO Drop Counters
          4. 4.3.1.2.4 Host Port – ALE Flood and Overrun Counters
          5. 4.3.1.2.5 MAC Port RX Issues
          6. 4.3.1.2.6 MAC Port TX Issues
          7. 4.3.1.2.7 Host Port RX Issues
          8. 4.3.1.2.8 Host Port TX Issues
    4. 4.4 Custom Board Enablement in SYSCFG
    5. 4.5 LwIP Debug Guide
      1. 4.5.1 LwIP Stack Configuration
      2. 4.5.2 lwip_stats
  8. 5Conclusion
  9. 6References

MAC Port Debugging

This section describes the process for debugging the MAC port.

  1. Step 1: When link never establishes after initialization.
    1. Begin by verifying the MAC port opened successfully.
    2. Set a breakpoint at the Enet_open() function and step through to the return value. ENET_SOK indicates success, but you must also verify the MAC port handle is non-NULL.
  2. Step 2: After the Enet_open() function succeeds.
    1. Set a breakpoint at the EnetMacPort_open() function or the port-specific variant like the Cpsw_openPort() function.
    2. Inspect the macCfg parameter before the call executes.
      Note: The macCfg.layerType field must match your hardware configuration exactly: ENET_MAC_LAYER_GMII_RGMII for RGMII interfaces or ENET_MAC_LAYER_RMII for RMII.

    3. Check the linkCfg.speed and linkCfg.duplexity fields.
      Note: If these fields are set to fixed values like ENET_SPEED_100MBIT and ENET_DUPLEX_FULL, but your link partner or PHY is configured for automatic negotiation, link never comes up. The most reliable approach is setting the speed to ENET_SPEED_AUTO and the duplexity to ENET_DUPLEX_AUTO, then letting the PHY handle negotiation. A mismatched speed or duplex between the MAC configuration and the PHY capability causes perpetual link-down states.

  3. Step 3: When link appears established in the PHY registers but no traffic flows.
    1. Verify the MAC port is actually enabled.
    2. Set a breakpoint at the Cpsw_enablePort() function, or equivalent, after link-up is detected.
      Note: If this function is never called, your link status callback is not triggering port enable, which is required even after a successful MAC initialization.

    3. Check the return code from the Cpsw_enablePort() function.
      Note: ENET_EPERM indicates the port was already enabled, which is harmless. ENET_EINVALIDPARAMS means the port number or configuration is wrong. A frequent configuration error is enabling the MAC port before the PHY reports link-up. The MAC port must remain disabled until the PHY link callback fires and confirms link establishment. Enabling the port prematurely causes the MAC to transmit into a disconnected PHY, resulting in dropped packets and no error indication.

    4. Set a watch point on your link status variable and verify the point transitions to true before the cpsw_enablePort() function is called.
      Note: If the sequence is reversed, restructure your initialization to wait for the PHY link-up before enabling the MAC port.

  4. Step 4: To verify correct MAC port configuration after initialization.
    1. Read back the port registers using the debug console or a memory browser.
      Note: The MAC mode register shows the interface type matching your hardware. The MAC control register indicates the port is enabled only after link-up. If these registers show unexpected values, the MAC configuration structure was not applied correctly, possibly due to using a default configuration instead of the hardware-specific settings. Always explicitly set the layerType, speed, and duplexity fields rather than relying on structure initialization defaults. When link is up and initialization succeeds, but the transmitted packets never appear on the wire, the problem lies in the TX submission path or DMA descriptor management.
  5. Step 5: Checking the packet queue
    1. Set a breakpoint at the EnetDma_submitTxPktQ() function in your transmit function.
    2. Examine the packet queue being submitted before the call executes.
    3. Check that the queue count is non-zero by inspecting the internal queue structure.
      Note: If the queue is empty, the problem is earlier in the code where the dequeue packets from txFreePktInfoQ. A common bug is calling the EnetQueue_deq() function on an exhausted free queue and not checking for a NULL return value, then attempting to submit an invalid packet pointer.
  6. Step 6: If the packet queue is valid.
    1. Inspect each sgList structure of the packet.
      Note: The first bufPtr of the segment must point to valid memory containing the Ethernet frame, and segmentFilledLen must equal the frame length. A common mistake is setting segmentFilledLen to the maximum buffer size instead of the actual frame length. This mistake causes the DMA to transmit garbage padding bytes, which potentially exceed the MTU and get dropped by the PHY or link partner.

    2. Step through and verify segmentFilledLen is between 64 and 1518 bytes for standard Ethernet frames.
  7. Step 7: After the EnetDma_submitTxPktQ() function returns.
    1. Check the status code.
      Note: ENET_SOK means the submission succeeded. ENET_EINVALIDPARAMS indicates the packet structure is malformed. ENET_ENOMEM means the DMA descriptor ring is full, which happens when transmitted packets are not being retrieved and freed.

    2. Set a breakpoint in the EnetDma_retrieveTxPktQ() function and verify this function is called regularly, typically from a periodic timer or after each transmit.
      Note: If this function is never called or called too infrequently, the TX descriptor ring fills up and transmission stops silently.