Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C6678 external emac loopback test not working

 Hi,

I want to develope external emac loopback utility for C6678.For this i use <PDK_INSTALL_DIR>\ti\drv\exampleProjects\PA_emacExample_exampleProject . In this project working properly for internal loopback. Now my work is it leads to external loopback. For this i change in header of cpsw_singlecore.c. In header i change cpswlpbkMode = CPSW_EXTERNAL_LOOPBACK. It hangs up for sgmii_init function for link up. its link remain 0 and it is not changed to 1. its set from CSL and tx_config register. I think phy init is not properly initilised . How can initilise it and get link_up to 1.

Thanks.

-Naresh

 

  • Hi Naresh,

    You need to do switch initializations. Please check the NDK examples that sends traffic to external PHY. Alternatively, run the gel file before running your code and see if that helps.

    Thanks,

    Arun.

  • Hi, Naresh:

    There are two EMAC (SGMII) ports connected to internal switch, port 0 is connected through AMC backplane as MAC-to-MAC connection and port 1 is connected to a Gbs PHY which is accessible through the RJ45 connector.

    I believe that EMAC port 0 is not available without the AMC chassis although the internal loopback does work.

    To enable external loopback, please make the following two changes:

    1. Int32 SendPacket (Void) at cppi_qmss_mgmt.c

    char            psFlags = 0x1; ==> char            psFlags = 0x2;

    2. Set global variable cpswEvm6678 to 1 before running the test program.

    It is up to you to provide external loopback.

    I am going to verify packet outputs this afternoon.

    Best regards,

    Eric Ruei

     

     

     

     

     

     

     

     

     

     

  • Hi eric,

    thanks for your kind support as early as possible.

    I think we will on right track for emac external loopback test utilty. But problem is same sgmii link up. In it it may be problem from sgmii initilization.

        pSgmiiStatus->bIsLinkUp             =   CSL_FEXT (hCpSgmiiRegs->SGMII_PORT[portNum].STATUS_REG, CPSGMII_STATUS_REG_LINK);
        pSgmiiStatus->bIsAutoNegError       =   CSL_FEXT (hCpSgmiiRegs->SGMII_PORT[portNum].STATUS_REG, CPSGMII_STATUS_REG_AN_ERROR);
        pSgmiiStatus->bIsAutoNegComplete    =   CSL_FEXT (hCpSgmiiRegs->SGMII_PORT[portNum].STATUS_REG, CPSGMII_STATUS_REG_MR_AN_COMPLETE);
        pSgmiiStatus->bIsLocked             =   CSL_FEXT (hCpSgmiiRegs->SGMII_PORT[portNum].STATUS_REG, CPSGMII_STATUS_REG_LOCK);

     

        pSgmiiStatus->bIsLinkUp  should be 1. pSgmiiStatus->bIsAutoNegComplete should be 1. It may set from phy side. but it not set to 1. How can comes from this ? At there this utility working for external loopback ? If we comes out from this problem then this utility working for emac external loopback.

    Thanks eric and all.

    With regards,

    Naresh

  • Hi, Naresh:

    Let's focus on the EMAC example code as your reference.

    As I mentioned earlier, there are two EMAC (SGMII) ports in C6678.

    At the C6678 EVM, port 0 is connected through the backplane and not usable for standalone EVM and port 1 is connected to a PHY which is accessible throught the RJ45 connector.

    It is OK to run the internal loopback test since the SGMII initialization routing  does not wait for the link up since both condition will fail.

            if (!cpswSimTest && ((cpswLpbkMode == CPSW_LOOPBACK_EXTERNAL) || (cpswLpbkMode == CPSW_LOOPBACK_NONE)))
            {
             do
             {
                 CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
             } while (sgmiiStatus.bIsLinkUp != 1);
     
             /* Wait for SGMII Autonegotiation to complete without error */
             do
             {
                 CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
                 if (sgmiiStatus.bIsAutoNegError != 0)
                     return -1;
             } while (sgmiiStatus.bIsAutoNegComplete != 1);
            }

    To perform external loopback or no loopback, only port 1 can be used.

    For link status check:

    1. Make sure that port 0 is forced link up by setting global variable cpswEvm6678 to 1. You can even remove the port 0 initialization code.

        if ((macPortNum == 0) && (cpswEvm6678))
        {

    #if 0 / remove port 0 initialization */
            /* EVM6678 back end: MAC-to-MAC force link */

            /* Reset the port before configuring it */
            CSL_SGMII_doSoftReset (macPortNum);       
            while (CSL_SGMII_getSoftResetStatus (macPortNum) != 0);  

            /* Hold the port in soft reset and set up
            * the SGMII control register:
            *      (1) Enable Master Mode (default)
            */
            CSL_SGMII_startRxTxSoftReset (macPortNum); 
            CSL_SGMII_enableMasterMode (macPortNum);
            if (cpswLpbkMode != CPSW_LOOPBACK_NONE)
            {
             CSL_SGMII_enableLoopback (macPortNum);
            }   
           
         /* Setup the Advertised Ability register for this port:
            *      (1) Enable Full duplex mode
            *      (2) Speed = 1000M
            *      (3) Force the Link
            */
            sgmiiCfg.bLinkUp        =   1;
            sgmiiCfg.linkSpeed      =   CSL_SGMII_1000_MBPS;
            sgmiiCfg.duplexMode     =   CSL_SGMII_FULL_DUPLEX;
            CSL_SGMII_setAdvAbility (macPortNum, &sgmiiCfg);
           
            CSL_SGMII_endRxTxSoftReset (macPortNum);  
       
         /* Wait for SGMII Link */
         do
         {
             CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
         } while (sgmiiStatus.bIsLinkUp != 1);

    #endif

    2. Please verify whether you observe SGMII link problem at port 1 after the first step.

    I have verified that we are able to receive the transmit packet if I cannect the RJ45 to external GMAC port.

    I do not see the link status light when I use the loopback connector. I am investigating the same.

    3. SendPacket() psFlags = 0x2 ==> Use EMAC port 1 instead of EMAC port 0.

    What is your final goal?

    To achieve the external loopback, you can also write a simple program or script to loopback all received packets from a PC.

    Best regards,

    Eric

     

     


        }

     

     

     

     

  • Hi, Naresh:

    I  have verified that the EVM can transmit and receive packets via the RJ45 connector.

    The root problem of the external loopback is that we need to configure 88E1111 to enable external loopback.

    I wrote simple GEL functions to enable/disable PHY external loopback.

    /* MDIO Registers */

    #define MDIOCTRL   (*((unsigned int *) 0x02090304))

    #define MDIOUSRACCESS0  (*((unsigned int *) 0x02090380))

    hotmenu MDIO_enable_phy_loopback()

    {

        //Enable MDIO Control

        MDIOCTRL |= 0x40000000;

       // Register 18 = 0 (disable all interrupts

        MDIOUSRACCESS0 = 0xC0010000 | (18 << 21) | 0;

       // Register 9 = 0x1F00

        MDIOUSRACCESS0 = 0xC0010000 | (9 << 21) | 0x1F00;

       // Register 0 = 0x9140

        MDIOUSRACCESS0 = 0xC0010000 | (0 << 21) | 0x9140;

       // Register 29 = 7 page 7

        MDIOUSRACCESS0 = 0xC0010000 | (29 << 21) | 0x0007;

       // Register 30 = 0x0808

        MDIOUSRACCESS0 = 0xC0010000 | (30 << 21) | 0x0808;

       // Register 29 = 0x10 page 16

        MDIOUSRACCESS0 = 0xC0010000 | (29 << 21) | 0x0010;

       // Register 30 = 0x005A

        MDIOUSRACCESS0 = 0xC0010000 | (30 << 21) | 0x005A;

       // Register 29 = 0x12 page 18

        MDIOUSRACCESS0 = 0xC0010000 | (29 << 21) | 0x0012;

        // Register 30 = 0x8241

        MDIOUSRACCESS0 = 0xC0010000 | (30 << 21) | 0x8241;

       // Disable MDIO Control

        MDIOCTRL &= 0xBFFFFFFFF;

    hotmenu MDIO_disable_phy_loopback()

    {

         //Enable MDIO Control

        MDIOCTRL |= 0x40000000;

         // Register 9 = 0x0F00

        MDIOUSRACCESS0 = 0xC0010000 | (9 << 21) | 0x0F00;

         // Register 0 = 0x9140

        MDIOUSRACCESS0 = 0xC0010000 | (0 << 21) | 0x9140;

         // Register 29 = 7 page 7

        MDIOUSRACCESS0 = 0xC0010000 | (29 << 21) | 0x0007;

        // Register 30 = 0x0800

        MDIOUSRACCESS0 = 0xC0010000 | (30 << 21) | 0x0800;

        // Register 29 = 0x10 page 16

        MDIOUSRACCESS0 = 0xC0010000 | (29 << 21) | 0x0010;

        // Register 30 = 0x0058

        MDIOUSRACCESS0 = 0xC0010000 | (30 << 21) | 0x0058;

        // Register 29 = 0x12 page 18

        MDIOUSRACCESS0 = 0xC0010000 | (29 << 21) | 0x0012;

        // Register 30 = 0x8240

        MDIOUSRACCESS0 = 0xC0010000 | (30 << 21) | 0x8240;

         // Disable MDIO Control

        MDIOCTRL &= 0xBFFFFFFFF;

     }

    Best regards,

    Eric

     

  • Hi Eric,

    First of all Thanks for kind and early support as possible from your side.

    As per your previous two response, We are nearest to achieve emac external loopback test.As per your reply, I come out from sgmii link up problem and it gives following output successfully.

    [C66xx_0] **************************************************
    [C66xx_0] ******* Ethernet Single Core Example Start *******
    [C66xx_0] **************************************************
    [C66xx_0] QMSS successfully initialized
    [C66xx_0] CPPI successfully initialized
    [C66xx_0] PASS successfully initialized
    [C66xx_0] Ethernet subsystem successfully initialized
    [C66xx_0] Tx setup successfully done
    [C66xx_0] Rx setup successfully done
    [C66xx_0] PASS setup successfully done
    [C66xx_0] Following is the ALE table before transmits.
    [C66xx_0] Port = 0, MAC address = 10:11:12:13:14:15, unicast_type = 0
    [C66xx_0] Port = 1, MAC address = 10:11:12:13:14:15, unicast_type = 0
    [C66xx_0] Port = 2, MAC address = 20:21:22:23:24:25, unicast_type = 0
    [C66xx_0] Packet Transmission Start ...
    [C66xx_0] Following is the ALE table after transmits.
    [C66xx_0] Port = 0, MAC address = 10:11:12:13:14:15, unicast_type = 0
    [C66xx_0] Port = 1, MAC address = 10:11:12:13:14:15, unicast_type = 0
    [C66xx_0] Port = 2, MAC address = 20:21:22:23:24:25, unicast_type = 0
    [C66xx_0] Packet Transmission Done.
    [C66xx_0] Wait for all packets to be Received ...
    [C66xx_0] Packets Sent        =    10
    [C66xx_0] Packets Received    =    10
    [C66xx_0] Example Done!
    [C66xx_0] **************************************************
    [C66xx_0] ******** Ethernet Single Core Example End ********
    [C66xx_0] **************************************************

    I thought that  we are successful but after removing RJ 45 loopback connector , I perform this test it also pass successfully and sent 10 packets and receive 10 packets. I think this loopback utility working finely but it is for emac to phy , not from phy to RJ 45 connector.  So how can reach this emac external loopback for RJ 45 ?

    With best regards,

    Naresh

  • Hi, Naresh:

    I am out of office and not be able to access the 6678EVM for two weeks.

    It looks like we have the PHY internal loopback work at least. (CPPI ==>SW==>EMAC==>SGMII==>SERDES==>PHY==>SERDES==>SGMII==>EMAC==>PA)

    In other word, the packets leave the C6678 and re-enter it by PHY loopbak.

    I can not verify the external loopback until I get back to my office.

    What is your next goal?

    Do you plan to send and receive EMAC pactets through RJ45 connector externally?

    There are NDK examples provided by the BIOS MCSDK package.

    Best regards,

    Eric

     

     

     

     

     

  • Hi Eric,

    Thanks for better support in emac loopback utility developement for C6678.

    My planning is develope RJ 45 loopback utility. We have reached C6678-PHY-C6678 loopback utility. I have to work for c6678-PHY-RJ 45 connector-PHY-c6678. Now i will extend it to RJ 45 connector and test it. If any problems related to this then after i will send you.

    With best regards,

    Naresh

  • Hi Eric,

    As per our previous work of emac external loopback test using RJ 45 loopack , my code becomes hang up by changing following thing in cpsw_singlecore.c.

     #ifdef  SIMULATOR_SUPPORT

    Int cpswSimTest = 0;

    Int cpswLpbkMode = CPSW_LOOPBAC_EXTERNAL;

    #else

    Int cpswSimTest = 1;

    Int cpswLpbkMode = CPSW_LOOPBAC_INTERNAL;

    #endif

    I want to know why it hang up ?

    Thanks.

    -Naresh

  • Hi, Naresh:

    Could you please tell me your intentions to change the default settings so that I can help you better?

    We are able to build the example project differently based on the compiler switch so that the tester can run the test at C6678 simultaor and EVM respectively.

    The variable cpswSimTest  should be set to non-zero only if the CCS traget is simulator.

    Best regards,

    Eric

     

     

    .

     

     

  • Hi, Naresh:

    I have finally been able to confirm that the external loopback will not work without the RJ45 loopback connector.

    The bottom LED is off even if we connect the RJ45 loopback connector prior to running the MDIO control script.

    The bottom LED is on (orange) after we run the MDIO control script and the loppback test passes.

    The bottom LED will be off after we remove the RJ45 loopback connector and the loopback test fails.

    Best regards,

    Eric

     

     

     

     

  • Hi Eric,

    I'm trying to run the PA_emacExample_exampleProject project on the EVM6678 with an external Superlooper on the

    Gigabit Ethernet connector (RJ45 connector) I have done the below changes - 

    - cppi_qmss_mgmt.c - psFlags = 0x1 to psFlags = 0x2;

    - cpsw_singlecore.c - cpswLpbkMode = CPSW_LOOPBACK_INTERNAL to cpswLpbkMode = CPSW_LOOPBACK_NONE

                          cpswEvm6678 = 0 to cpswEvm6678 = 1

    - cpsw_mgmt.c - in function Init_Cpsw init only SGMII port 1 (macPortNum = 0 to macPortNum = 1)

    - cpsw_mgmt.c - add to the Init_MDIO function

    /*

    * MDIO_disable_phy_loopback()

    */

    //Enable MDIO Control

    hMdioRegs->CONTROL_REG |= 0x40000000;

        // Register 9 = 0x0F00

    hMdioRegs->USER_GROUP[0].USER_ACCESS_REG = 0xC0010000 | (9 << 21) | 0x0F00;

        // Register 0 = 0x9140

    hMdioRegs->USER_GROUP[0].USER_ACCESS_REG = 0xC0010000 | (0 << 21) | 0x9140;

        // Register 29 = 7 page 7

    hMdioRegs->USER_GROUP[0].USER_ACCESS_REG = 0xC0010000 | (29 << 21) | 0x0007;

        // Register 30 = 0x0800

    hMdioRegs->USER_GROUP[0].USER_ACCESS_REG = 0xC0010000 | (30 << 21) | 0x0800;

        // Register 29 = 0x10 page 16

    hMdioRegs->USER_GROUP[0].USER_ACCESS_REG = 0xC0010000 | (29 << 21) | 0x0010;

        // Register 30 = 0x0058

    hMdioRegs->USER_GROUP[0].USER_ACCESS_REG = 0xC0010000 | (30 << 21) | 0x0058;

        // Register 29 = 0x12 page 18

    hMdioRegs->USER_GROUP[0].USER_ACCESS_REG = 0xC0010000 | (29 << 21) | 0x0012;

        // Register 30 = 0x8240

    hMdioRegs->USER_GROUP[0].USER_ACCESS_REG = 0xC0010000 | (30 << 21) | 0x8240;

        // Disable MDIO Control

    hMdioRegs->CONTROL_REG &= 0xBFFFFFFFF;

     

    and nothing is received, any additional changes I need to do? 

    I don't see any lights on the RJ45? 

     

    [C66xx_0] **************************************************

    [C66xx_0] ******* Ethernet Single Core Example Start *******

    [C66xx_0] **************************************************

    [C66xx_0] QMSS successfully initialized 

    [C66xx_0] CPPI successfully initialized 

    [C66xx_0] PASS successfully initialized 

    [C66xx_0] Ethernet subsystem successfully initialized 

    [C66xx_0] Tx setup successfully done 

    [C66xx_0] Rx setup successfully done 

    [C66xx_0] PASS setup successfully done 

    [C66xx_0] Following is the ALE table before transmits.

    [C66xx_0] Packet Transmission Start ... 

    [C66xx_0] Following is the ALE table after transmits.

    [C66xx_0] Port = 0, MAC address = 00:01:02:03:04:05, unicast_type = 3

    [C66xx_0] Packet Transmission Done.

    [C66xx_0] Wait for all packets to be Received ... 

    [C66xx_0] Received 0 packets so far...

     

    Thanks,

    HR

  • Hi, HR:

    Have you tried internal loopback yet?

    For GB external loopback, you need to make the loopback connector.

    The normal Ethernet RJ45 loopback connector only works for 10/100M Ethernet

    Here is the  reference pin out:

    1-3, 2-6, 5-8, 4-7

    If the loopback cable works, the bottom LED at the RJ45 connector should be on as orange.

    Best regards,

    Eric

     

     

     

    .

     

     

  • Hi Eric,

    The internal loopback worked before the changes, I will prepare a Giga Eth. loopback connector,

    Thanks,

    HR

  • Hi Eric,

    I have checked the Superlooper I'm using and it's supporting Giga Ethernet (I have checked the pin out connection) but I'm not getting the orange LED, what am I missing?

    Thanks,

    HR

  • Hi, HR:

    The Phy should be up at power up.

    If you connect the RJ45 connector to a 10/100M Ethernet port, the bottom (left) LED should be on as green.

    If you connect the RJ45 connector to a Giag-Ethernet port, the bottom (left) LED should be on as orange.

    Replace the normal cabel with the RJ45 loopback connector.

    Connect the platform to CCS.

    Perform system reset.

    Run GEL script "Global Default Setup"

    Run the GEL script "MDIO_enable_phy_loopback"

    You may need to run the last step a few times.

    Please let me know whetehr it works for you!

    Best regards,

     

    Eric

     

     

     

     

     

     

  • Hi Eric,

    Great ! it works, I'm getting the orange LED, why should I run the GEL script "MDIO_enable_phy_loopback" a  few times before I'm getting the orange LED and I assume I need to use the "MDIO_disable_phy_loopback" GEL script for the PA_emacExample_exampleProject, is this correct?

    Many Thanks,

    HR

  • Hi, HR:

    I am so glad that it finally works for you.

    You do not need to run the MDIO scripts if you are not using external phy loopback.

    It seems to me that the MDIO access with GEL script i not 100% reliable, let's why you may need to run the script a couple of times.

    Can you tell me why you will need external PHY loopback just for my curiosity?!

    Isn't SGMII loopback good enough?

    Best regards,

    Eric

     

     

     

     

     

  • Hi Eric,

    Currently I have just one board but I will want to connect two boards via the Eth.,

    For running the external phy connection do I need to run the GEL script "MDIO_enable_phy_loopback" and set cpswLpbkMode to CPSW_LOOPBACK_NONE or to CPSW_LOOPBACK_EXTERNAL?

    What does the GEL script "MDIO_disable_phy_loopback" do?

    Where can I find the  88E1111 data sheet?

    Thank you very much for the help,

    HR

  • Hi, HR:

    For 88E1111 data sheet, you will have to register on the Marvell website.  The data sheet is only available under NDA with Marvell and we can’t give them the versions we have without violating our NDA.

    For the loopback operation, when cpswLpbkMode is set to any value other than CPSW_LOOPBACK_NONE, the PASS will be configured to receive the test packets which were sent by PASS.

    CPSW_LOOPBACK_INTERNAL: SGMII (internal) loopback

    CPSW_LOOPBACK_EXTERNAL: Loopback occurs outside the platform including RJ45 connector or cable loopback. For Gigabit Ethernet, it is not enough to just use a RJ45 connector loopback, we need to enable the PHY loopback by executing "MDIO_enable_phy_loopback".

    If cpswLpbkMode is set to CPSW_LOOPBACK_NONE, the PASS will be configured to receive the packet with swapped MAC address. This is the normal operation. One way to test this is to write a small program which will receiv the test packet, swap the MAC address and send it back. The test program will run at the platform (Linux, Windows and etc) which is connected to the 6678 (6670) EVM via a normal Ethernet cable.

    In my opinion, the external loopback does not add much value other than verifying the 88E1111 connection.

    Best reagrds,

    Eric

     

  • Hi Eric,

    - OK, I will try to get the 88E1111 data sheet from Marvell,

    - In case I'm using the TO_PORT in the PS_FLAGS and the ALE_BYPASS bit in the ALE_CONTROL reg. than I assume I will be able to use CPSW_LOOPBACK_NONE, is this correct?

    - Will there be an updated MDIO access GEL or function?

    Thank you very much,

    HR

  • Hi, HR:

    - In case I'm using the TO_PORT in the PS_FLAGS and the ALE_BYPASS bit in the ALE_CONTROL reg. than I assume I will be able to use CPSW_LOOPBACK_NONE, is this correct?

    [Eric] You can use the TO_PORT in the PS_FLAGS to specify which EMAC port the egress packets go. However, you do not need to set ALE_BYPASS if you use CPSW_LOOPBACK_NONE. Please note that all the loopback modes are special test cases in which we intend to receive the egress packets as ingress packets.

    If you intend to loopback the egress packets without MAC address swapping, you need to use one of the loopback modes. In normal operation, each platform will have its own MAC and IP address, the egress packets will use them as source addresses and the ingress packets will use them as destination addresses.

    - Will there be an updated MDIO access GEL or function?

    [Eric] I am still not see the need for Ethernet cable or PHY loopback. If you need external loopback, you may want to convert the MDIO access GEL script to a C function.

    You say that you will have two platfoms which connect to each other eventually. I will recommend that you may want to use internal loopback to complete your initial tests and switch to normal configuration when the other EVM is available.

    Best regards,

    Eric

     

     

     

     

     

     

     

  • Hi Eric,

    - As I will connect the two boards in PtP connection than I don't worry too much for the MAC address's so I was thinking to use the ALE_BYPASS for the ingress,

    - I already converted the GEL file to C function but the question is how do I now that it works as I had to run the GEL script a few time?

    Thank you very much for the help,

    HR

  • Hi, HR:

    - As I will connect the two boards in PtP connection than I don't worry too much for the MAC address's so I was thinking to use the ALE_BYPASS for the ingress,

    [Eric] It should be fine! But, I still do not know why you need to enable PHY loopback. You can use internal loopback for single platform and external loopback for PtoP connection if you choose to use the same MAC address for both platform.s Note: You will not enable PHY loopback for PtoP.

    - I already converted the GEL file to C function but the question is how do I now that it works as I had to run the GEL script a few time?

    [Eric] I will look into this issue. I think that the script may miss some MDIO initialization so that MDIO access is not reliable. I shall get back to you later.

     

  • Hi Eric,

    - Just to see if I understood, If I'm using the external 1G superlooper with ALE_BYPASS than both external/none loopback will work, I agree that I should use the external loopback,

    - I't will be great to have a reliable MDIO init,

    Thank you very much,

    HR

  • Dear HR:

    I am still wondering why you need to enable the PHY loopback with the external IG superlooper. I believe that you do not need the external 1G supperlooper at all. You will need to set cpswLpbk to CPSW_LOOPBACK_INTERNAL for single EVM. You will set cpswLpbk to CPSW_LOOPBACK_EXTERNAL if you want to run the same test code at two back-to-back EVMs. You can also updtae the SW and SGMII configuration based on your application. The ALE_BYPASS should be enabled only if you expect to receive the ingress packets wih the same MAC header of the egress packets.

    There is no need to use the external 1G supperlooper and/or to update the default PHY configuration with MDIO scripts.

    However, I will still look into the MDIO assess issue.

    Best regards,

    Eric