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.

SGMII to SGMII connection

Hi,

I have a customer that is having a hard time getting his 6678 connect to an SGMII-GMII bridge (Max24288). They are using an example from TI’s PDK package, namely the “pdk_C6678_1_1_2_6_old\packages\ti\drv\exampleProjects\PA_emacExample_exampleProject”, to configure the SGMII interface of the 6678.  The example was modified to use the SGMII 0 port instead of  SGMII 1.  That is pretty much the only difference from the original source from TI. However:

  • They are able to perform both internal SGMII and SERDES loopbacks within the DSP but not outside the DSP.
  • They are able to perform GMII loopbacks within the MAX24288 chip.
  • They cannot get any traffic to pass from the TI DSP (SGMII) to the SGMII interface chip (MAX24288).

I consulted the doc recommended (on post #104726: http://www.ti.com/lit/ug/sprugv9b/sprugv9b.pdf) but I don't see anything that could help; However I could not figure out if the 6678 expected the interface chip to be in SGMII master or Slave mode?

 Could you possibly have someone review the SGMII port 1 to SGMII port 0 change that my customer did on the TI example code please? You might have some suggestions to make this work.

Please advise as I need help on this issue badly.

Thanks
Electrons4me

  • Hey Electrons, 

    Let's try to see what's the problem here. 

    "They are able to perform both internal SGMII and SERDES loopbacks within the DSP but not outside the DSP." The PA_EMAC example you referenced can of course be changed into external and internal loopback modes for the Ethernet module (I'm certain you guys know how to change it in the API). However, when you send it outside the SerDes loop for an external loop, this code is assuming you're sending it out to a wire that loops it back in the exact same format. Your setup instead is looking for a SGMI negociation code (from what I'm seeing here, feel free to correct me). Where it's a SGMII to SGMII communication. That EMAC example I don't believe is setup for that, but I'd have to check.


    So there are 4 SGMII transfer modes:

    1) SGMII Mode with PHY Configuration Autonegotiation- For when conncting to an external PHY

    2) SGMII Master to SGMII Slave with Autonegotiation Configuration-> This is basically for two SGMII Devices (looks like your setup). One has to be set as master and slave. 

    3) SGMII slave to SGMII master with Autonegotiation Configuration

    4) SGMII to SGMII with Forced Link Configuration -> Generally only used when autonegotiation isn't doing well. 

    So on your board it's basically DSP->Switch->RJ45->  Cable->Remote board. If this has no DSP, choose option one. If you're going through a phy to another DSP, still use the first option (for both DSPs). The default configuration for the DSP is a slave. The sgmii to sgmii configuration is used if there is a mac port & switch in between. I.e.:

     DSP(SGMII port) - (MAC port)Switch(Phy port)- RJ45

    So if you want to do SGMI to SGMII you're going to have to pick a format and have your code for that. I see that you have customer code that has edited the code for that, but I don't see an attachment. Hopefully the information helps you above. 

    If you want to debug the connection, I suggest looking at the port stats. I.e. RXGOODFRAMES, etc. They're very helpful to tell you what packets that port has rx, and the TXGOODFRAMES tells you how many it has sent. "Where" depends on your flow. 

    Related Resources: 

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/284600/994632.aspx#994632

    http://focus.ti.com/docs/training/catalog/events/event.jhtml?sku=OLT110027

  • Hello Katherine,

    Thanks for your reply.

    1. The connection is: DSP-- (SGMII-to-GMII bridge chip)--Switch--RJ45--Cable--PC

    Because the connection between the 6678 and the SGMII-to-GMII bridge chip is two SGMII connections back to back, the customer used the sgmii to sgmii. Is this correct?

    2. To answer your question on customer code not attached, it is because this is a "sensitive" customer aka military so I cannot post their code and wanted to send it directly to you. Please let me know to send you the code?

    3. {Katherine wrote:} So if you want to do SGMI to SGMII you're going to have to pick a format and have your code for that.
    Electrons: Would you have exemple code with the rigth format (SGMI to SGMII) for that that I could pass along to the customer so they could try it? 

    Thanks again
    Sebastien 

  • Hey Sebastien. 

    1. Correct.

    2. You can send it directly to me at my email (kat@ti.com), but I also understand not sending it. I think this forum put you guys in the right direction and you might be able to solve it yourselves. In addition to any privacy concerns.

    3. I don't know of any code off the top of my head that is available. But I know other customers have been able to accomplish it, so I don't think it is a complicated process. Check the user guide, I believe it has the register details needed there for the setup. Specifically the SGMII CONTROL register. 


    Resources:

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/t/239734.aspx

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/214628/759822.aspx#759822

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/217552/784677.aspx#784677

     http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/t/260578.aspx

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/119109/426126.aspx#426126

  • Hey Sebastien, 

    I see the code you sent us. I think you guys need to think simpler on how to enable this. You just need to write those values to the address. So for pseduo code here: 

    1. Define your address for MR_ADV_ABILITY & SGMII Control & SGMII_STATUS (the user guide has the offsets. I usually do a #define earlier in the code) 

    2. in your SGMII setup write to that address for that register the values we talked about earlier. Just straight right to the register to enable it. 

    MR_ADV_ABILITY &= 0xFFFF0000; // Clear the register contents
    MR_ADV_ABILITY |= 0x00009801; // Full duplex gigabit configuration

    SGMII_CONTROL |= 0x00000020; // Master Mode, no autonegotiation 

    3.Poll the bit

    waitfor ( bit in SGMII STATUS is indicating link is up).


    3. Go into the mac setup and do the same thing, but just straight up writing to the EXT_EN bit.


    See how that works, it's not that complicated I promise! You could even write a function and refer to it. 


    -Kat 

  • Hey Kat!

    Could you confirm for me that: @file  pa_mgmt.c

       @function       Add_MACAddress (line 181)

    if the following : pa_EMAC_PORT_0 vs pa_EMAC_PORT_1 (line 192) does the trick to use the proper port (i.e "0")? I'm really unsure about that. Is that all the customer needs to do in regard to to config the SW for the desired Ethernet port?

    Thanks
    E4Me 

  • Hey E4me, 

    Here is more information on auto neg. When setting upt he SGMII modules: 

    *((volatile unsigned int *) (SGMII_BASE + 0x10)) |= 0x00000001; //Set SGMII Control Register -- setting PHY as master, SGMII as slave
    //enable autonegotiation, slave mode

    (if you wanted to do it for master mode) 

    *((volatile unsigned int *) (SGMII_BASE[i] + 0x10)) |= 0x00000021; //Set SGMII Control Register -- setting PHY as master, SGMII as slave
    //enable autonegotiation, slave mode

    Obviously there is some stuff here that is not included as far as variable names, but you get the idea. It's in a for loop for each SGMII that you're configuring. 

    switch(setup.nss_switch.sgmii_mode)
    {
    case FORCED:
    case MASTERAN:
    //while in master mode, configure the MR_ADV_ABILITY to 0x9801 0r 0x9401
    *((volatile unsigned int *) (SGMII_BASE[i] + 0x18)) = setup.nss_switch.adv_ability; //Set the MR_ADV_ABILITY register
    // 15: LINK 1'b1
    // 14: AUTO-NEGOTIATION ACKNOWLEDGE 1'b0
    // 13: ?? 1'b0
    // 12: DUPLEX MODE 1'b1
    //11-10: SPEED 2'b10
    //09-01: ?? 9'b000000000 -- always 0
    // 00: ?? 1'b1 - always 1
    break;
    case SLAVEAN:
    *((volatile unsigned int *) (SGMII_BASE[i] + 0x18)) = 0x00000001; //Set the MR_ADV_ABILITY register - MAC to PHY config
    //While configuring SGMII in slave mode configure the Advertise ability to 1
    break;
    }

    // IF MR_AN_ENABLE Restart auto-negotiation
    if((*((volatile unsigned int *) (SGMII_BASE[i] + 0x10)) & 0x00000001) == 0x00000001)
    {
    *((volatile unsigned int *) (SGMII_BASE[i] + 0x10)) |= 0x00000002; // Set SGMII auto-negotiation restart

    *((volatile unsigned int *) (SGMII_BASE[i] + 0x10)) &= 0xFFFFFFFD; //Clear SGMII auto-negotiation restart
    }

    //time_before = CSL_tscRead();
    //Check to make sure that the LOCK, FIB_SIG_DECT & LINK bit is set in the STATUS register
    while ((*((volatile unsigned int *) (SGMII_BASE[i] + 0x14)) & 0x00000031) != 0x00000031);
    // while ((*((volatile unsigned int *) (SGMII_BASE[i] + 0x14)) & 0x00000001) != 0x00000001);

    // IF MR_AN_ENABLE Check auto-negotiation complete
    if((*((volatile unsigned int *) (SGMII_BASE[i] + 0x10)) & 0x00000001) == 0x00000001)
    {
    //Check to make sure that the MR_PAGE_RX & MR_AN_COMPLETE bit is set in the STATUS register
    while ((*((volatile unsigned int *) (SGMII_BASE[i] + 0x14)) & 0x0000000C) != 0x0000000C);
    }
    //time_after = CSL_tscRead();

    //printf("Took %d cycles to complete auto-negotiation and get SGMII link\n", (time_after - time_before));
    if(debug)
    printf("1GBE: Auto-negotiation and got SGMII link %d\n", i);

    }// END BRACKET OF FOR LOOP

    Then you set the information for the PHY REG in your MDIO. 

    Now, for the SGMII setup for 0 vs 1, you definitely want to look into cpsw_mgmt.c. Ther are some SGMII configurations that are set in there. So if anything calls those functions that are in there (init_sgmii is a good one to look at) make sure it only passes port_0. 

    Have the team tried looping from the "outside" into their MAC24288 to loopback (taking our device out of the equation) to verify it works? Just to remove another factor. 

    Good luck!

    Kat

  • Hey Electrons!

    We have same configuration and problem (link did not up).

    Have you solved your problem ?

    Andrey

  • Hi Andrey,

    We would recommend you to create new thread for faster response. Old threads will get less attention then new.

    Thank you.