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.

How to use two ethernet ports of c6678 at the same time

Other Parts Discussed in Thread: SYSBIOS

Hi, I have a custom board of c6678 with two ethernet ports. in this post "e2e.ti.com/.../974898, it changes NIMU to to use the two ethnet interfaces of c6678 at the same time. I have changed the nimu and rebuild it. but I have no idea of how to change the code of example HelloWorld to assign two different IP to ethernet port 0 and port 1. (Since the above post was created about 3 years ago, I asked this question under that post, no one replied, I created this post). In helloWorld.c, it seems the following code is used to configure IP for one of the two ports. 
CI_IPNET NA;
CI_ROUTE RT;
IPN IPTmp;

// 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;

// Add the address to interface 1
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);

// Add the route
CfgAddEntry( hCfg, CFGTAG_ROUTE, 0, 0,
sizeof(CI_ROUTE), (UINT8 *)&RT, 0 );

I duplicated the above code with different IP variables, but I can only get one IP added(seems the callback function NetworkIPAddr() only execute once).
So here is my question:
1. How do I change the code of NDK init code in helloWorld.c in order to use the two ethernet ports at the same time with two different IPs?
2. CfgAddEntry( hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *)&NA, 0 );
it seems this function is not use to assign an IP to the physical ethernet port. because i tried to change the platform_init() to init different SGMII, not change helloWorld.c. the ethernet can work properly. My question here is: How could I know which physical ethernet port I am configuring with the IP address? I am very confused about this problem.
ps: my ccs version is:5.2.1.00018
ndk version: ndk_2_21_01_38
pkd version: pdk_C6678_1_1_1_4
bios version: bios_6_33_06_50
mcsdk version: mcsdk_2_01_01_04
thanks.

  • Hi,

    I've notified the ethernet experts. Feedback will be posted here.

    Best Regards,
    Yordan
  • Hi,

    In the NDK helloworld.c file, if you want to use both EMACs, you need two stacks. The task (StackTest) is defined by .cfg file. So you need to add another task in .cfg to create another task, so NetworkIPAddr will be called again as NC_NetStart() was called in both tasks.

    The EVM_init() is also a SYSBIOS task, it calls platform_init with sFlags.phy = 1; In the platform library:
    if (p_flags->phy) {
    configSerdes();
    // Init_SGMII(0);
    Init_SGMII(1);
    }
    You need to uncomment Init_SGMII(0) as well.

    Regards, Eric
  • hi, lding
    thanks for your reply. Now I can init both EMACs in c6678 and assign different IP to the two ethernet ports. Now I face another problem: I want to use both the ethernet port simmultaneously, because the data transfered on the two ports are different and when there's data to be sent/received is random. In SYS/BIOS, only one task can run, at the same time, other tasks are in the ready status. So Now I want to use ethernet port 0 in core0, port 1 in core1 in order to use the two ports at the same time. I have tried to init port 1 in core1 as core0 does, but it didn't work.
    Please tell me what should I do to init the two ports sepeartely in core0 and core1 to make them work properly?
  • Hi,

    I assume you use the same task priority for both tasks, and one task runs a certain time then switch to the other task. Do you see the complete packets loss for the ready task?

    Regards, Eric