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.

Enabling Interface 2 (Port 2) of DM648 in NDK Ver.1.94.1 helloworld.pjt

Other Parts Discussed in Thread: CCSTUDIO

Hello,

I am trying to integrate NDK for TCP/IP ethernet capability to my legacy software running on DM648. I use the following environment: CCS3.3,BIOS 5.31.08,CGT 6.0.16. I found NDK ver.1.94.1 as a right candidate to integrate as it can work with these versions of CCS,BIOS and CGT.

I was trying to evaluate this version of NDK by running the helloworld project in C:\CCStudio_v3.3\ndk_1_94_1\packages\ti\ndk\example\network\helloWorld. I use the NSP from DM648_BIOSPSP_RELEASE_1_10_01 as suggested in the page http://processors.wiki.ti.com/index.php/Network_Developers_Kit_Licensing_and_Availability

My custom board has two Marvel PHY chips each connected to each of the physical ports of the DM648 EMAC. When i run the helloworld example, i get the following prints. I have modified the helloworld project to work on a static ip of 192.168.0.9

TCP/IP Stack 'Hello World!' Application

Using MAC Address: 34-b1-f7-2f-ec-63
cpsw_MDIO_Init
SetPhyMode:000021E1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD1000:8192 LPBK:0
cpsw_MDIO_Init
SetPhyMode:000021E1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD1000:8192 LPBK:0
cpsw_MDIO_FindingState: PhyNum: 0
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_PhYReset(0)
Enable Phy to negotiate external connection
NWAY Advertising: FullDuplex-1000 FullDuplex-100 HalfDuplex-100 FullDuplex-10 HalfDuplex-10
Network Added: If-1:192.168.0.9
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
Phy: 0, NegMode 01E1, NWAYadvertise 01E1, NWAYREadvertise 4DE1
Negotiated connection: FullDuplex 100 Mbs
Link Status: 100Mb/s Full Duplex on PHY 0
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!
cpsw_MDIO_FindingState: Timed Out looking for a Phy!

As you can see above, the PHY0 is detected but PHY1 is not detected and it tells that "Timed Out looking for a Phy!" PHY1. Both PHY chips are the same make and i wonder why the second one is not detected by NDK1.94.1. I even tried changing the interface id to 2 for the below line of code in StackTest(), but still got the same prints..

// Add the address to interface 2
CfgAddEntry( hCfg, CFGTAG_IPNET, 2, 0,sizeof(CI_IPNET), (UINT8 *)&NA, 0 );

Is only Interface 1 supported in NDK?

I intend to use both the ethernet ports of DM648 to be configured with different IPs and connect to different networks. Is this supported by NDK?

SP

  • Any quick responses to my above query is appreciated..
  • Hi SP,

    I am not familiar with this NDK version as this is very old version. I talked to our NDK expert and it looks like this version does contain support for multiple interfaces though you will need to update the driver to add another instance for the second interface.

    The good news is I have a copy of the changes to the driver though I should warn you it has not been tested (at-least no one has tried it in the recent years) but it can act as a guideline to you.

    Hope it helps.

    Vikram

    0624.DualEmacSetupDM648.zip

  • Vikram,

    I found that the driver changes you gave in your last post is exactly the same as mentioned in the TI wiki page http://processors.wiki.ti.com/index.php/Using_two_DM648_EMACs_separately

    I had already tried that as per the instructions in the WIKI page, but unfortunately, it didn't work for me. Its based off NDK2.0.

    The observations are:

    1- The PHY0 connected to port 0 was detected by the stack but PHY1 connected to port 1 was not detected by the stack and i kept getting "Timed Out looking for a Phy!" prints on Stdout of CCS. Any clues, why the second PHY doesn't get detected by the Stack initialization functions?

    2- The Link LED of port 0 connector blinks once each time when i run the helloworld.exe application on the windows side indicating that data reaches the link. But when i debug the helloworld DSP project on the CCS side, i see that the deamon callback function "dtask_udp_hello" is never invoked anytime when i run the helloworld.exe indicating that the data sent from windows host is not being received by the DSP.

    3-Link LED of the Port1 connector is continously ON after the stack is initialized and starts running..

    4- I couldn't ping to any of the ports after i ran the modified "client" sample application given in the wiki page, I am using exactly the same versions of tools mentioned in the wiki page.. 

    5- The Wiki page tells that "Requires EVMDM648 Board Support Library installed and the environment variable %BSL_EVMDM648_INSTALLDIR% properly set.This package is supplied by Lyrtech and requires registration of an EVMDM648 development board.It is automatically set during the installation of Lyrtech EVMDM648 package". I don't have the Lyrtech CD with me now because it has been so many years since we bought the EVM. But even if i remove the BSL.lib from the project settings, the project still builds fine without errors!!.. Moreover, I didn't see any Board Specific API's called within the project source files..I would still like to try with the BSL installed..Could you please send me the DM648 BSL installation, if you have it with you?

    Also, i would like to know whether the latest versions of NDK supports the usage of both the DM648 ports for connecting to different networks or not? 

    Is there any compatibilty issue for NDK2.0 with the versions of compiler(6.1.11) , DSP/BIOS(5.33.05) i use? I am suspecting this because i don't see the daemon callback function "dtask_udp_hello" being invoked when there is some activity on the Link..

    SP

  • Vikram.. Could you please give your comments?
  • Hi SP,

    A couple of comments:

    SP said:
    cpsw_MDIO_FindingState: Timed Out looking for a Phy!
    cpsw_MDIO_FindingState: Timed Out looking for a Phy!
    cpsw_MDIO_FindingState: Timed Out looking for a Phy!

    These error messages are coming from the DM648 driver.  From what I can tell, any problem you are having at this point is due to an issue in the DM648 driver.

    I want to warn you, this is a very old driver at this point and support will be limited for it.  You may find that you are mostly on your own in debugging this driver, especially since very few in the community seem to be using this device any more.

    Having said that, I spent some time digging through the driver code and I think the question you need to answer is this:

    What is the result of the following code?

        #define myMDIO_ALIVE           MDIO_ALIVE(PhyDev->miibase)
        ...
        PhyAcks=myMDIO_ALIVE;
        PhyAcks&=PhyMask;   /* Only interested in 'our' Phys */

    The above code is coming from the DM648 driver file cpsw_miimdio.c, in the function _cpsw_MDIO_FindingState() (around lines 545-546).

    I think for some reason the "MDIO is not alive" and that is causing the failure (if you look down in the code just below the above two lines, you will see the error message that's showing up in your output).

    I also checked into the PhyMask, and I think this is being set properly.  It is being set in ethdriver.c, in Setup_EmacInitConfig():

        /* Program default MAC SL config */
        for (i=0; i < CPSW3G_NUM_MAC_PORTS; i++)
        {
    	    if(0 == i)
    	    {
    		    /* program phy_mask for port 0 */
    		    iCfg->macInitCfg[i].PhyMask = 0x1;/*corresponding to Addr=0*/
    		    iCfg->macInitCfg[i].MLinkMask = 0x0;
    	    }
    	    else
    	    {
    		    /* program phy_mask for port 1 */
    		    iCfg->macInitCfg[i].PhyMask = 0x2;/*corresponding to address 1 */
    		    iCfg->macInitCfg[i].MLinkMask = 0x0;
    	    }/* end of else block covering settings for port 1 */

    Again, I think the mask is being set properly, but the code is failing because the same corresponding bit is not set in:

     PhyAcks=myMDIO_ALIVE;

    Resulting in the AND operation against the PhyMask to be zero:

        PhyAcks&=PhyMask;   /* Only interested in 'our' Phys */
    

    For your reference, here are some other notes I have while tracing through the code, as this may be helpful for you:

    1. cpgmacMacOpen() is called for each phy (?) but cpsw_MDIO_Init() is called with hard coded MDIO_BASEADDR.  Is this ok?

    static void cpgmacMacOpen(Cpsw3gPort *hPort)
    {
    ...
        cpsw_MDIO_Init(&gmacObject->PhyDev, MDIO_BASEADDR, instId,macInitCfg->PhyMask,
                  macInitCfg->MLinkMask, 0,0, 0,
                  cpswCfg->mdioBusFrequency,cpswCfg->mdioClockFrequency,0);
    ...
    }

    2. cpgmacMacOpen() is called (indirectly through fxn cpsw3g_port_open()) for each phy in EMAC_open()

        /* Open all ports */
        for(i=0;i<CPSW3G_NUM_PORTS; i++)
        {
            localDev.cpsw3gPort[i].portNum = i;
            localDev.cpsw3gPort[i].chNum = i;
            cpsw3g_port_open(&localDev.cpsw3gPort[i]);
        }/* end of for loop over PORTS */
    
    
    Steve