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 SGMII port 0 won't transmit packet

My board has 3 C6678 DSPs. Each DSP has SGMII-0 connection to an Ethernet switch (SGMII to SGMII). The links are up, however, when I run my code (ported from helloworld project), after DHCP client is running, the DSP is unable to communicate with external DHCP server.

I'm using MCSDK 2_00_08_20,  and PDK C6678_1_0_0_20

[C66xx_0] TCP/IP Stack 'Hello World!' Application

[C66xx_0] PASS successfully initialized

[C66xx_0] Ethernet subsystem successfully initialized

[C66xx_0] Ethernet eventId : 48 and vectId (Interrupt) : 7

[C66xx_0] Registration of the EMAC Successful, waiting for link up ..

[C66xx_0] Service Status: DHCPC    : Enabled  :          : 000

[C66xx_0] Service Status: DHCPC    : Enabled  : Running  : 000

[C66xx_0] Service Status: DHCPC    : Enabled  : Fault    : 002

 

First I have a question, in helloworld.c, in the following code, which interface I should use, 0 or 1? I want to use SGMII-0. But if I change dhcpc.cisargs.lfIdx = 0, then above code will end up with NIMUIOCTL error code -22. So currently I'm setting it as 1.

 // Else we specify DHCP    

else     {        

           CI_SERVICE_DHCPC dhcpc;

        // Specify DHCP Service on IF-1

         bzero( &dhcpc, sizeof(dhcpc) );

         dhcpc.cisargs.Mode   = CIS_FLG_IFIDXVALID;

         dhcpc.cisargs.IfIdx  = 1;

         dhcpc.cisargs.pCbSrv = &ServiceReport;

         CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0,   sizeof(dhcpc), (UINT8 *)&dhcpc, 0 );    

}

 When I look into the Gigabit Ethernet Switch sub system's statistic memory (0x209_0B00), I can see:

1. The switch port 0 is receving packets and transmit packets. The switch port 0 is the host port, not the SGMII-0.

2. The switch port 1 (the SGMII-0 port) is receiving packets, but not transmit packets. The Carrier Sense Error register reports Carrier Senser Error. The link is duplex.

0x209_0b00: 0000004c  - PORT 0 (host port) receiving frames

0x209_0b34:  00033f7d - PORT 0 (host port) transmit frames

0x209_0c00:  000343cb - PORT 1 (SGMII-0) receiving frames

0x209_0c34: 00000000 - PORT 1 (SGMII-0) transmit frames, it is not transmitting

0x209_0c60: 000b129 - PORT 1 (SGMII-0) carrier sensor error register

Any idea?

Thank you for your help.

 

Chao

  • Chao, 

    Let's see if we can work through this. I think we have some confusion so let's clear the air on some of these. The ingress packets (from network to the device) and the egress packets (from device to the network) are what we're working with.

    0x0209_0b00:  Port 0 [Egress, into CPSW] is  receiving frames, so it's being transferred from the switch into the cpsw [STATS A]

    0x0206_0b34:  Port 0 [ingress packets, out of CPSW] is transmitting frames back into the device [STATS A]

    0x0209_0c00: Port 1 [Ingress Packets, out into the device] is transmitting frames into the device [STATS B] 

    0x0209_0c34: Port 1 [Egress packets, into the network] is NOT transferring frames into the network [STATS B] 

    So, basically the SGMII port is receiving frames from the network into the device, but isn't transferring them out. You're losing the packets after SGMII receives them and not sending them into the device. This means either the SGMII is receiving the packets too quickly for it to send out, or that The EMAC/gigabit ethernet swtich is unable to process the packets being sent out in a timely manner or has no memory to do so. 

    Look into the gigabit Ethernet swtich (GBE) for more help on what could be a problem. Possibly the EMAC is unable to take those packets under it's current configuration.

    Regards

    Kat Kelsch 

  • Thank you for looking into this. I just got this problem solved. The issue is that I'm using SGMII0 and the PDK only supports SGMII1. So all packets the device sents are routed to SGMII1, not SGMII0. That is why the Carrier Senser Error register is set.

    In nimu_eth.c, inside EMACInit_Core() function, the SW only looks for port which has mode of PLATFORM_EMAC_PORT_MODE_PHY.

    for (i = 0; i < PLATFORM_MAX_EMAC_PORT_NUM; i++)    

    {        

        platform_get_emac_info (i, &emac_info);       

       if (emac_info.mode == PLATFORM_EMAC_PORT_MODE_PHY)         {             break;         }    

    }

    But in In platform.c, SGMII0 mode is defined as PLATFORM_EMAC_PORT_MODE_AMC

    So I modified the platform.c to fake the SGMII0 mode, and it worked.

    emac_port_mode[PLATFORM_MAX_EMAC_PORT_NUM] =

    {

    // CHAO HU: fake SGMII 0 as PHY. In nimu_eth.c, function EMACInit_Core() only looks for PHY port

    //    PLATFORM_EMAC_PORT_MODE_AMC,

    PLATFORM_EMAC_PORT_MODE_PHY,

    //~CHAO HU

    PLATFORM_EMAC_PORT_MODE_PHY

    };

     

    I believe there are other bugs in the code, for example, in platform_get_emac_info() function always gets MAC address for SGMII1 port regardless what port_num is passed into the function. So in the system where both SGMII0 and SGMII 1 are used, there will be problem. However, in my hardware, only SGMII0 is used, so I'm fine now.

     

    Chao Hu

  • Hello Chao,

    I just wanted to confirm that your assumption was correct. There was  1 other other places where I had to modify the driver to get it to transmit properly.

    1) EmacSend uses this call Cppi_setPSFlags (Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, (1<<gTxPort)) which is valid when using SGMII1 but will not work when using SGMII0. Without that the loopback example (Hello_word) was not working

    I made one more change to the driver but not sure how it is affecting...

    2) in Init_Cpsw assign the mac address of your ethernet port to the wrong switch port. I do not know if this was causing a problem but it is incorrect in my opinion.

    Finally a question for you, you said that in the initialization of the DHCP, you had to make a change to the ifindex that is configured.from

    dhcpc.cisargs.IfIdx  = 1 to dhcpc.cisargs.IfIdx  = 0 Is this correct? I am asking because my code is working without this change and if I do what you advised, nothing works anymore. The reason I am asking is that since I have made the changes that you described, extract/reconnect does not work anymore. I have been trying to resolve this problem for a while but with no success.

    Aymeric

  • ifdex = 1 was correct.

     

    Only change I made is to this:

    emac_port_mode[PLATFORM_MAX_EMAC_PORT_NUM] =

    {

    // CHAO HU: fake SGMII 0 as PHY. In nimu_eth.c, function EMACInit_Core() only looks for PHY port

    //    PLATFORM_EMAC_PORT_MODE_AMC,

    PLATFORM_EMAC_PORT_MODE_PHY,

    //~CHAO HU

    PLATFORM_EMAC_PORT_MODE_PHY

    };

     

    And both helloworld and testudp are working.

    My ndk version is version 2_21_01_38, pkd version is  1_1_2_5.

    As the mac address, I believe it is a bug. But if you don't use two ports simultaneously, you will be fine. It is still a unique MAC address.

  • Chao,

    Thanks for confirming. I am still puzzled. (pdk_C6670_1_1_0_3 - ndk_2_21_01_38). I do not think that the fact that you work on C6678 is the difference (who knows)

    I reverted all my changes (even though I think they are correct) and made one and only one change, the one you advised. As previously, hello word and test udp works but it does not reconnect.

    If I run hello world on the evaluation board (on SGMII1, no change in platform or library), I can run hello world from EVM (static or dynamic), ping it and run hello word from my PC. Then, I can disconnect the fiber, reconnect it and run like I never disconnected the fiber.

    If I run from my HW which is using SGMII0 AND the only change that you advised (and I agree). After disconnection/ reconnection, I will not be able to ping my board anymore or run hello world from my PC.

    TI has not be very helpful, I almost wished you had the same problem (-:

    Thanks for your feedback, glad that you resolved your issue

    Aymeric

  • My HW actaully has C6678 connected to an on-board Ethernet switch (Vitess VSC7389), and the other port of the Switch connect to external copper Ethernet.

    I have tried unplug and re-plug ethernet cable, and both helleworld and testudp can recover.

    Do you have Switch between DSP and external network, or just a SGMII to BASE-X phy? If PHY, do you set PHY as autonegotiate (salve)?