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.

RTOS/PROCESSOR-SDK-TDAX: How to set Ethernet Port with External Ethernet Switch?

Part Number: PROCESSOR-SDK-TDAX
Other Parts Discussed in Thread: TDA2

Tool/software: TI-RTOS

I am working on project using TDA2xx(X5777A7XGABC) in Custom board.

I am developing with vision sdk 03.06 & ndk_2_24_02_31 & nsp_gmacsw_4_16_00_00.

My system is as follows.

  * TDA2 RGMII-0 <--> Another System

  * TDA2 RGMII-1 <--> External Ethernet Switch(NXP SJA1105) <--> Port1/2/3/4/5

I rebuild nsp as dual emac mode. NSP is executed in a15(RTOS).

External Ethernet Switch don't have MDIO. It is seperately initialized by SPI. It is controlled correctly.

vision_sdk\links_fw\src\rtos\utils_common\ndk\ndk_nsp_hooks.c

GMACSW_Config *GMACSW_getConfig(void)

{

 ......

 pGMACSWConfig->macInitCfg[i].mdioModeFlags = MDIO_MODEFLG_NOPHY;

 ......

 pGMACSWConfig->macInitCfg[i].macConnectionType = MAC_CONNECTION_TYPE_RGMII_FORCE_100_FULL;

 ......

 pGMACSWConfig->macInitCfg[i].phyMask = (uint32_t)((uint32_t)0x1 << (uint32_t)(0));

 ......

}

I sure that TXC(25Mhz)/RXC(25Mhz) each is output. I confirmed MAC Address in console log.

I assigned static IP Address.

[HOST  ] MAC Port 0 Address:
[HOST  ]        6c-c3-74-1e-23-1e

[HOST  ] MAC Port 1 Address:
[HOST  ]        6c-c3-74-1e-23-1f

[IPU1-0]   3097.101171 s:  My IP address for interface 1 : 169.254.252.100
[IPU1-0]   3097.101262 s:  My IP address for interface 2 : 169.254.253.101

How do I modify RGMII-1? Please let me know if it's wrong or if there are additional edit points.

  • Hi Jongyoun,

    Help me understand you query better. So you want to connect

    1. RGMII0 (MAC Port 0) to a different system(I believe you mean PC by system, in that case you are configuring it in normal mode, i.e not PHY-less)

    2. RGMII1 (MAC Port 1) to a switch, in which you need a MAC 2 MAC connection. 

    If this is the case, you have rightly re-built the NSP in dual mac mode. You static IP assignment also looks good to me. Only place where it looks fishy is you're assigning NO_PHY mode and PhyMask to both the interfaces. In your case, shouldn't you be configuring RGMII1 as NO_PHY and the other one differently?

    Regards,
    Anand

  • Hi Anand.
    Thanks for the answer. I will explain more about the system.
    1. RGMII0 (MAC to MAC) : Another System(TDA2 direct without PHY)
    2. RGMII1 (MAC to MAC) : The Other System(TDA2 with External Ethernet Switch)
    Both ports are connected as MAC to MAC. I guess I'll set it up together.
    1. How do I set this up?
    2. And how do I PING test it in the RTOS?
    3. Do I need to set up additional pinmux and interrupts?
    Regards,
    Jongyoun
  • Hi Anand.
    RGMII0/1 are not working. All ports don't have any Data Signal.
    But TX Clock output when Rx Clock is received.
    After building sdk, when you see the generated file in the binaries folder at the following location, there is ti_ndk_config_ip_init function.
    * vision_sdk/binaries/apps/tda2xx_evm_bios_all/obj/vision_sdk/tda2xx-evm/a15_0/release/vision_sdk_configuro/package/cfg/MAIN_APP_a15_0_pa15fg.c

    Void ti_ndk_config_ip_init(HANDLE hCfg)
    {
        /* Add our global hostname to hCfg (to be claimed in all connected domains) */
        CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0,
                     strlen(ti_ndk_config_Global_HostName),
                     (UINT8 *)ti_ndk_config_Global_HostName, 0);

        /* Configure IP address manually on interface 1 */
        {
            CI_IPNET NA;
            CI_ROUTE RT;
            /* Setup manual IP address */
            bzero(&NA, sizeof(NA));
            NA.IPAddr  = inet_addr(LocalIPAddr);
            NA.IPMask  = inet_addr(LocalIPMask);
            strcpy(NA.Domain, DomainName);
            NA.NetType = 0;

            CfgAddEntry(hCfg, CFGTAG_IPNET, 1, 0,
                    sizeof(CI_IPNET), (UINT8 *)&NA, 0);

            /*
             *  Add the default gateway. Since it is the default, the
             *  destination address and mask are both zero (we go ahead
             *  and show the assignment for clarity).
             */
            bzero(&RT, sizeof(RT));
            RT.IPDestAddr = 0;
            RT.IPDestMask = 0;
            RT.IPGateAddr = inet_addr(GatewayIP);

            CfgAddEntry(hCfg, CFGTAG_ROUTE, 0, 0,
                    sizeof(CI_ROUTE), (UINT8 *)&RT, 0);
        }
    }

    Is it OK to set only interface1 when setting to dual mac?
    NC_NetStart(ndk\netctrl\netctrl.c) --> NS_BootTask(ndk\netctrl\netnetsrv.c) -> SPIpNet(ndk\netctrl\netnetsrv.c) --> NtAddNetwork(ndk\nettools\ipaddr\ipaddr.c)
    It seems that the NtAddNetwork is run with the following path by that setting
    And the dual mac is not considered.
    Is it unrelated?
    please answer about my question.
    Regards,
    Jongyoun
  • Hi Jongyoun,

    Don't worry about the configuration of the second interface not being added in NDK. That's taken care in the ndk_nsp_hooks.c file in vision sdk. How did you ping to the interfaces? If you used two different PCs, do both of them have static IPs in the matching subnet? I mean, are the static IPs of your PCs something like 169.254.252.x and 169.254.253.x ?

    Regards,
    Anand

  • Hi Anand,

    I modified it as follows.

    1. I applied patch (vision_sdk\docs\Patches\0001-PAD-Mux-changes-to-enable-Dual-MAC.patch)

    2. ti_components/networking/nsp_gmacsw_4_16_00_00/packages/ti/nsp/drv/config.bld (Line84 ~ 86)

    3. vision_sdk/links_fw/src/rtos/bios_app_common/tda2xx/cfg/NDK_config.cfg (enableStaticIpEth0 = 0 -> 1, enableStaticIpEth1 = 0->1)

    if(NdkProcToUse=="a15_0")
     if (enableStaticIpEth0)
     {
        /* Settings for static IP configuration */
        Ip.address = "169.254.252.100";
        Ip.mask = "255.255.255.0";

        Ip.gatewayIpAddr = "169.254.252.1";
        Ip.ifIdx = 1;
     }

    4. vision_sdk/links_fw/src/rtos/utils_common/src/ndk/ndk_nsp_hooks.c

    GMACSW_Config *GMACSW_getConfig(void)

    {

     ......

     pGMACSWConfig->macInitCfg[i].mdioModeFlags = MDIO_MODEFLG_NOPHY;

     ......

     pGMACSWConfig->macInitCfg[i].macConnectionType = MAC_CONNECTION_TYPE_RGMII_FORCE_100_FULL;

     ......

     pGMACSWConfig->macInitCfg[i].phyMask = (uint32_t)((uint32_t)0x1 << (uint32_t)(0));

     ......

    }

    void stackInitHookStaticEth1(void *hCfg)
    {
        /*Static IP Address settings for interface 2*/
        const char *ip_addr_2 = "169.254.253.101";
        const char *ip_mask_2 = "255.255.255.0";
        const char *ip_gateway_2 = "169.254.253.1";

        .................

        .................

    }

    5. NDK rebuild

    Is it OK?

    And I tested it as follows.

    * RGMII0(169.254.252.100 / TI-RTOS) -> I don't try to test yet.

    * RGMII1(169.254.253.101 / TI-RTOS) --> Ethernet Swtich --> TDA2(static IP 169.254.253.105 / Linux) or PC(static IP 169.254.253.50 / Windows) :  I don't try to test yet.

    * RGMII1(169.254.253.101 / TI-RTOS) <-- Ethernet Swtich <-- TDA2(static IP 169.254.253.105 / Linux) or PC(static IP 169.254.253.50 / Windows) : RGMII1 is not working

    * TDA2(static IP 169.254.253.105 / Linux) --> Ethernet Swtich -->  PC(static IP 169.254.253.50 / Windows) : Ping test complete.

    * PC(static IP 169.254.253.50 / Windows) --> Ethernet Swtich --> TDA2(static IP 169.254.253.105 / Linux)  : Ping test complete.

    Regards,

    Jongyoun

  • Hi Anand,

    I'm currently continuing the test.
    vision_sdk/links_fw/src/rtos/bios_app_common/tda2xx/cfg/NDK_config.cfg
    enableStaticIpEth0 = 1
    enableStaticIpEth1 = 1
    The value is set as above.
    On booting time, LLIGenArpPacket is called(eth1), LLITxIpPacket is called(eth0).
    Function is located in ndk_2_24_02_31\packages\ti\ndk\stack\lli\lliout.c
    When I change the value of either enableStaticIpEth0 or enableStaticIpEth1 to 0,
     LLITxIpPacket is called(eth0) periodically after booting is completed.
    Do you have any reason to guess?
    Regards,
    Jongyoun
  • Hi Anand,

    I'm currently checking NDK/NSP source code.
    NIMU_NDK_start function is called twice when I enable DUAL_MAC.(eth0, eth1)
    However, there is one question during source code checking.
    * nsp_gmacsw_4_16_00_00/packages/ti/nsp/drv/ndk2nsp/ndk2nsp.h
    typedef struct NDK2NSP_OBJECT_
    {
        .............
        uint8_t         bMacAddr[MAC_NUM_PORTS][6];
        ............
    }NDK2NSP_Object, *NDK2NSP_Handle;
    * nsp_gmacsw_4_16_00_00/packages/ti/nsp/drv/ndk2nsp/nimu_ndk.c
    static int NIMU_NDK_start(NETIF_DEVICE *pNETIFDevice)
    {
        /*This variable tells us if we are dealing with interface 1 or 2*/
        uint32_t devIdx = pNETIFDevice->index-1U;
        ...................

        /* Open the translation layer, which itself opens the hardware driver */
        hNDK2NSP = NDK2NSP_open((STKEVENT_Handle)pNETIFDevice->pvt_data);

        if (NULL != hNDK2NSP)
        {

            .................

            /* Copy the MAC Address into the network interface object here. */
            mmCopy(&pNETIFDevice->mac_address[0], &hNDK2NSP->bMacAddr[0], (uint)6U);

            /* Set the 'initial' Receive Filter */
            hNDK2NSP->Filter = ETH_PKTFLT_ALL;
            if(0U == devIdx)
            {
                NDK2NSP_setRx(hNDK2NSP);
            }

            .........

        }

    }

    When copying the value of bMacAddr, why not refer to devIdx?

    Regards,
    Jongyoun
  • Hi Jongyoun,

    It is an issue, and I can give you a patch for this. It is a book keeping structure which is used by the stack. This doesn't functionally affect the data flow, unless you try to send/recv data to/from eth1 and eth0 interfaces from the same physical port (which is not expected from the current implementation, as dual mac and switch mode of the GMACSW is not supported together now). There is an internal SW filter which forwards the packets depending on port. This should take care of the issue. But looking at your setup, I believe this should not affect you as you are trying to communicate with eth1 from the RGMII1, which should work fine. 

    Are you unable to receive data in the devices connected to your switch?

    Regards,
    Anand

  • Hi Jongyoun,

    Any updates on this?

    Regards,
    Anand

  • Hi Jongyoun,

    Any updates on this yet? Shall I assume you were able to get past the issue?

    Regards,
    Anand