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.

helloworld_evmc6678l loopback

Other Parts Discussed in Thread: SYSBIOS, TMS320C6678

Greetings TI-Community,

I am using the 6678 EVM Board TMDXEVM6678LE and following setup:

XDC_Tools   3.23.4.60

MCSDK          2.1.2.6

PDK               1.1.26

sysBios         6.33.65

ccompiler     Ti 7.4

Now I tried to setup the helloworld_evmc6678l example in...mcsdk_examples_ndk_helloworld with the possibility to loopback the udp_deamon internally (loopback in the GbE switch) for performance testing purpose.

To do so I have to change the the SGMII_Control register from the DSP. This is done in the GEL file for the EVM platform or in the EVM_Init() function in the code.

I compared the exmaples simple_example and emac_example in ...pdk_package_ti_drv_pa_example directory with the helloworld_evmc6678l example.

Until now I was not able to success.

I also recognize that the register names in the DSP sheet do not match with the names used in the functions for the EVM board. I do not find such a documentation on the Advantech site. It would be helpfull if you want to manipulate the EVM_Init subroutines. 

Thank you

Patrick

  • Patrick,

    Welcome to the TI E2E forum. I hope you will find many good answers here.
    In addition you can find some details through the TI.com documents and the TI Wiki Pages.
    Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics.

    You see the NDK stack based helloworld project and PA LLD based example projects at the below path in the MCSDK.
    mcsdk_2_01_02_06\examples\ndk\helloWorld
    pdk_C6678_1_1_2_6\packages\ti\drv\exampleProjects\PA_simpleExample_exampleProject

    These are two different set of examples for NDK and PA. The EVM_init call have the platform based initialization.
    Refer the platform Lib at : pdk_C6678_1_1_2_6\packages\ti\platform\evmc6678l

    This wiki page will be useful,
    http://processors.wiki.ti.com/index.php/BIOS_MCSDK_2.0_User_Guide

    Find out the relevant document at the product folder:
    http://www.ti.com/product/tms320c6678
    http://www.ti.com/product/TMS320C6678/technicaldocuments
    Which register name is not getting clarity?

  • Greetings Pubesh,

    I changed the evmc6678_phy.c in ...\ti\pdk_C6678_1_1_2_6\packages\ti\platform\evmc6678l\platform_lib\src.

    I recognized while Step-Debugging that the original Init_SGMII (uint32_t macPortNum) function is called with the define Flag SIMULATOR_SUPPORT. Is this the right default case?

    I modified this function with the ability to initialize the loopback in the switch as mentioned in

    http://www.ti.com/lit/ug/sprugv9d/sprugv9d.pdf

    page 72 chapter 2.4.3.1 Digital Loopback.

    So my new Init_SGMII (uint32_t macPortNum) function in evmc6678_phy.c looks like (Simulator #ifdef-part completly outcommented):

    /** ============================================================================
     *   @n@b Init_SGMII
     *
     *   @b Description
     *   @n SGMII peripheral initialization code.
     *
     *   @param[in]
     *   @n macPortNum      MAC port number for which the SGMII port setup must
     *                      be performed.
     *
     *   @return
     *   @n None
     * =============================================================================
     */
    /*
    #ifdef SIMULATOR_SUPPORT
    void Init_SGMII (uint32_t macPortNum)
    {
        CSL_SGMII_ADVABILITY    sgmiiCfg;
    	CSL_SGMII_STATUS        sgmiiStatus;
    
    	/* 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
         *      (2) Enable Auto-negotiation
         /
        CSL_SGMII_startRxTxSoftReset (macPortNum);
        CSL_SGMII_enableMasterMode (macPortNum);
        CSL_SGMII_enableAutoNegotiation (macPortNum);
        CSL_SGMII_endRxTxSoftReset (macPortNum);
    
        /* Setup the Advertised Ability register for this port:
         *      (1) Enable Full duplex mode
         *      (2) Enable Auto Negotiation
         *      (3) Enable the Link
         /
        sgmiiCfg.linkSpeed      =   CSL_SGMII_1000_MBPS;
        sgmiiCfg.duplexMode     =   CSL_SGMII_FULL_DUPLEX;
        CSL_SGMII_setAdvAbility (macPortNum, &sgmiiCfg);
    
        /* All done with configuration. Return Now. /
        return;
    }
    #else
    */
    void Init_SGMII (uint32_t macPortNum)
    {
    	#define LOOPBACK_PORT0
    	#define LOOPBACK_PORT1
        CSL_SGMII_ADVABILITY    sgmiiCfg;
        CSL_SGMII_STATUS        sgmiiStatus;
    
        /* Reset the port before configuring it */
        CSL_SGMII_doSoftReset (macPortNum);
        while (CSL_SGMII_getSoftResetStatus (macPortNum) != 0);
    
         if (macPortNum == 1) {
    		#ifdef(LOOPBACK_PORT1)
        		 CSL_SGMII_disableAutoNegotiation(macPortNum);	//1 Clear to 0 the MR_AN_ENABLE bit in the SGMII_CONTROL Register
        		 CSL_SGMII_startRxTxSoftReset(macPortNum);	//2 Write to 1 the RT_SOFT_RESET bit in the SOFT_RESET Register
        		 CSL_SGMII_enableLoopback(macPortNum); 	 	//3 Write to 1 the LOOPBACK bit in the SGMII_CONTROL Register
        		 CSL_SGMII_endRxTxSoftReset(macPortNum); 	//4 Write to zero the RT_SOFT_RESET bit in the SOFT_RESET Register
    		#else
    			/* Hold the port in soft reset and set up
    			 * the SGMII control register:
    			 *      (1) Disable Master Mode
    			 *      (2) Enable Auto-negotiation
    			 */
    			CSL_SGMII_startRxTxSoftReset (macPortNum);
    			CSL_SGMII_disableMasterMode (macPortNum);
    			CSL_SGMII_enableAutoNegotiation (macPortNum);
    			CSL_SGMII_endRxTxSoftReset (macPortNum);
    
    			/* Setup the Advertised Ability register for this port:
    			 *      (1) Enable Full duplex mode
    			 *      (2) Enable Auto Negotiation
    			 *      (3) Enable the Link
    			 */
    			sgmiiCfg.linkSpeed      =   CSL_SGMII_1000_MBPS;
    			sgmiiCfg.duplexMode     =   CSL_SGMII_FULL_DUPLEX;
    			CSL_SGMII_setAdvAbility (macPortNum, &sgmiiCfg);
    
    			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; /* This is an error condition */
    			} while (sgmiiStatus.bIsAutoNegComplete != 1);
    		#endif
        }
    
        if (macPortNum == 0) {
    		#ifdef(LOOPBACK_PORT0)
    			 CSL_SGMII_disableAutoNegotiation(macPortNum);//1 Clear to 0 the MR_AN_ENABLE bit in the SGMII_CONTROL Register
    			 CSL_SGMII_startRxTxSoftReset(macPortNum);    //2 Write to 1 the RT_SOFT_RESET bit in the SOFT_RESET Register
    			 CSL_SGMII_enableLoopback(macPortNum); 	      //3 Write to 1 the LOOPBACK bit in the SGMII_CONTROL Register
    			 CSL_SGMII_endRxTxSoftReset(macPortNum);      //4 Write to zero the RT_SOFT_RESET bit in the SOFT_RESET Register
    		#else
    			/* Hold the port in soft reset and set up
    			 * the SGMII control register:
    			 *      (1) Disable Master Mode
    			 *      (2) Enable Auto-negotiation
    			 */
    			CSL_SGMII_startRxTxSoftReset (macPortNum);
    			CSL_SGMII_disableMasterMode (macPortNum);
    			CSL_SGMII_enableAutoNegotiation (macPortNum);
    			CSL_SGMII_endRxTxSoftReset (macPortNum);
    
    			/* Setup the Advertised Ability register for this port:
    			 *      (1) Enable Full duplex mode
    			 *      (2) Enable Auto Negotiation
    			 *      (3) Enable the Link
    			 */
    			sgmiiCfg.linkSpeed      =   CSL_SGMII_1000_MBPS;
    			sgmiiCfg.duplexMode     =   CSL_SGMII_FULL_DUPLEX;
    			sgmiiCfg.bLinkUp        =   1;
    			CSL_SGMII_setAdvAbility (macPortNum, &sgmiiCfg);
    
    			do
    			{
    				CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
    			} while (sgmiiStatus.bIsLinkUp != 1);
    		#endif
         }
    
        /* All done with configuration. Return Now. */
        return;
    }
    //#endif

    The programm executes well, but the loopback does not work. I can still ping the target with a defined static IP (enabled ICMP in sysBios). I also disabled the run to main option in the configuration file and checked the startup function option in sysBios for the EVM_Init() call. I controlled this by doing Step-Debugging.

    Thank You

    Patrick

  • Patrick,

    If you are running the NDK example project(), please follow the steps.

    Make sure to execute the EVM initialization GEL on the core the examples will be run on.

    The GEL can be found under "CCSv5 installation path: "\ccsv5\ccs_base_w.x.y.zzzzz\emulation\boards\evmc66xxl\gel\evmc66xxl.gel.

    Load your helloworld program: select the core 0 and select Run --> Load --> Load program. Browse and select
    the .out program you compiled.

    This program implements a UDP echo server, which echos back any input it receives.
    To test it as is, use with helloWorld.exe from \winapps directory.
    C:\ti\ndk_2_21_01_38\packages\ti\ndk\winapps

  • Greetings Pubesh,

    my current workflow is as the following:

    1. System Reset + CPU Reset

    2. Load GEL-File (console show up the memory mapping output)

    3. Scripts -> EVMC6678L Init Functions -> Global_Default_Setup

    4. Load Programm (with running to and startup option as mentioned above)

    If I only load the GEL-Files without step 3.) the programm executes but it runs very slow. I got a Debug Task which only let a LED running at 1HZ. Without Step 3.) the LED is very slow. With Step 3.) the LED blinks as predicted. I do not know the cause yet.

    The Global_Default_Setup function sets up only  the SERDES with configSGMIISerdes() but not the Switchports. This is done in the EVM_Init().

    The UDP-Testprogramm in /winapps should not be suiteable for me if I want to setup a loopback in the switch.

    Thank you

    Patrick 

  • Patrick,

    For Digital Loopback mode:
    MAC transmit to MAC receive loopback mode support.

    The SGMII module supports the ability to internally connect the transmit signals to the receive signals.
    It is important to note that this is digital loopback, because the transmit and receive signals are connected before reaching the SerDes module.

    Refer the MAC example project at: pdk_C6678_1_1_2_6\packages\ti\drv\exampleProjects\PA_emacExample_exampleProject
    Here, you need to enable "CPSW_LOOPBACK_INTERNAL". See the CSL_SGMII_enableLoopback function, SGMII port number for which loopback must be enabled.

  • Greetings Pubesh,

    the problem is fixed.

    The changes I had made in evmc6678_phy.c in ...\ti\pdk_C6678_1_1_2_6\packages\ti\platform\evmc6678l\platform_lib\src was not build. In the reassembly view it  runs the prior version of that file.

    So I add the loopback in the EVM_Init() function. The loopback now works well.

    void EVM_init()
    {
     platform_init_flags   sFlags;
     platform_init_config  sConfig;
     /* Status of the call to initialize the platform */
     int32_t pform_status;
    
     /* 
      * You can choose what to initialize on the platform by setting the following 
      * flags. Things like the DDR, PLL, etc should have been set by the boot loader.
     */
     memset( (void *) &sFlags,  0, sizeof(platform_init_flags));
     memset( (void *) &sConfig, 0, sizeof(platform_init_config));
    
        sFlags.pll  = 0; /* PLLs for clocking    */
        sFlags.ddr  = 0;     /* External memory    */
        sFlags.tcsl = 1; /* Time stamp counter   */
    #if defined(_SCBP6618X_) || defined(DIGITAL_LOOPBACK)
        sFlags.phy  = 0; /* Ethernet       */
    #else
        sFlags.phy  = 1; /* Ethernet       */
    #endif
        sFlags.ecc  = 0; /* Memory ECC       */
    
        sConfig.pllm = 0;  /* Use libraries default clock divisor */
    
     pform_status = platform_init(&sFlags, &sConfig);
    
    #ifdef DIGITAL_LOOPBACK
     	 int macPortNum = 1;
     	 CSL_SGMII_doSoftReset (macPortNum);
     	 while (CSL_SGMII_getSoftResetStatus (macPortNum) != 0);
    
     	 CSL_SGMII_disableAutoNegotiation(macPortNum);			//1 Clear to 0 the MR_AN_ENABLE bit in the SGMII_CONTROL Register
             CSL_SGMII_startRxTxSoftReset(macPortNum);	 	 		//2 Write to 1 the RT_SOFT_RESET bit in the SOFT_RESET Register
             CSL_SGMII_enableLoopback(macPortNum); 	 	 	        //3 Write to 1 the LOOPBACK bit in the SGMII_CONTROL Register
             CSL_SGMII_endRxTxSoftReset(macPortNum); 	 	 		//4 Write to zero the RT_SOFT_RESET bit in the SOFT_RESET Register
    #endif
    
     /* If we initialized the platform okay */
     if (pform_status != Platform_EOK) {
       /* Initialization of the platform failed... die */
       while (1) {
         (void) platform_led(1, PLATFORM_LED_ON, PLATFORM_USER_LED_CLASS);
         (void) platform_delay(50000);
         (void) platform_led(1, PLATFORM_LED_OFF, PLATFORM_USER_LED_CLASS);
         (void) platform_delay(50000);
       }
     }
    
    }

    Thank you for your patience and help

    Patrick

  • Patrick,

    This discussion and code snippet will be helpful for the future readers, If you verify this thread to close.