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.

Question about init port into SGMII

Other Parts Discussed in Thread: TMS320C6678

I have problem with init ports into SGMII in Ethernet Gigabit SubSystem. I use TMS320C6678 1000 MHz device with

the Alaska Ultra 88E1111 Gigabit Ethernet Transceiver. It's customer board, not EVM. My text for init:

/* init psc */

static void _init_psc()
{

CSL_PSC_enablePowerDomain(CSL_PSC_PD_PASS);

CSL_PSC_setModuleNextState(CSL_PSC_LPSC_PKTPROC, PSC_MODSTATE_ENABLE);
CSL_PSC_setModuleNextState(CSL_PSC_LPSC_CPGMAC, PSC_MODSTATE_ENABLE);

CSL_PSC_startStateTransition(CSL_PSC_PD_PASS);

while(!CSL_PSC_isStateTransitionDone(CSL_PSC_PD_PASS));
}

/* init pll */

static void _init_pll()
{
u32 pllst;

union _cfgpll_t
{
u16 data;
struct
{
u16 en : 1;
u16 mpy : 7;
u16 endiv : 1;
u16 vrange : 1;
u16 sleep : 1;
u16 loop_bw : 2;
u16 bypass : 2;
u16 std : 1;
};
};

union _cfgrx_t
{
u32 data;
struct
{
u32 en : 1;
u32 busw : 3;
u32 rate : 2;
u32 invpair : 1;
u32 term : 3;
u32 align : 2;
u32 los : 3;
u32 cdr : 3;
u32 eq : 4;
u32 enoc : 1;
u32 lo : 2;
u32 : 7;
};
};

union _cfgtx_t
{
u32 data;
struct
{
u32 en : 1;
u32 busw : 3;
u32 rate : 2;
u32 invpair : 1;
u32 cm : 1;
u32 swing : 4;
u32 demph : 4;
u32 mysnc : 1;
u32 enidl : 1;
u32 rdtct : 2;
u32 lo : 2;
u32 : 10;
};
};

/* pll config */
_cfgpll_t pll = { 0 };
pll.en = 1;
pll.vrange = 1;
pll.mpy = 20; /* 5x == 7'b0010100 */

/* RX config */
_cfgrx_t rx = { 0 };
rx.en = 1;
rx.rate = 2;
rx.term = 4;
rx.align = 1;
rx.eq = 12;
rx.enoc = 1;

/* TX config */
_cfgtx_t tx = { 0 };
tx.en = 1;
tx.rate = 2;
tx.cm = 1;
tx.swing = 8;
tx.mysnc = 1;

/* Unlock the chip configuration registers to allow SGMII SERDES registers to
* be written */
CSL_BootCfgUnlockKicker();
CSL_BootCfgSetSGMIIConfigPLL(pll.data);
s32 cnt = -1;
do
{
cnt++;
CSL_BootCfgGetSGMIISERDESStatus(&pllst);
}
while((pllst & 0x00000001) == 0);

CSL_BootCfgSetSGMIIRxConfig(0, rx.data);
CSL_BootCfgSetSGMIITxConfig(0, tx.data);
CSL_BootCfgSetSGMIIRxConfig(1, rx.data);
CSL_BootCfgSetSGMIITxConfig(1, tx.data);
CSL_BootCfgLockKicker();

}

/* init port */

static void _init_port(u32 id)
{
CSL_SGMII_ADVABILITY cfg = { 0 };
CSL_SGMII_STATUS status = { 0 };

/* reset SGMII */
CSL_SGMII_doSoftReset(id);
while(CSL_SGMII_getSoftResetStatus(id) != 0);

/* Hold the port in soft reset and set up
* the SGMII control register:
* (1) Enable Master Mode (default)
* (2) Enable Auto-negotiation
*/
CSL_SGMII_startRxTxSoftReset(id);
CSL_SGMII_disableMasterMode(id);

/* Setup the Advertised Ability register for this port:
* (1) Enable Full duplex mode
* (2) Enable Auto Negotiation
*/
cfg.linkSpeed = CSL_SGMII_100_MBPS;
cfg.duplexMode = CSL_SGMII_FULL_DUPLEX;
CSL_SGMII_setAdvAbility(id, &cfg);

CSL_SGMII_enableAutoNegotiation(id);
CSL_SGMII_endRxTxSoftReset(id);

/* wait for SGMII link */
CSL_SGMII_restartAutoNegotiation(id);
do
{
CSL_SGMII_getStatus(id, &status);
}
while(status.bIsLinkUp != 1);

/* I have error */

. . . .
}

I take boot parameters from TMS320C6678 Multicore Fixed and Floating-Point Digital Signal Processor

2.5.4 PLL boot Configuration Settings - page 41.

Where I make eror?

Best regards,

   Oleg

  • Hi Oleg,

    I hope you are following the initialization sequence from EVM for custom board. I could not find any issue with initialization.

    I was referring to Init_SGMII() function from PDK directory.

    You may need to wait some more time for the external PHY to be ready to transmit packets reliably. It is possible to access the PHY status register through the MDIO interface to check when the PHY is ready or error bits.

    Thank you.
  • Hi all,
    I have a problem with initialization SGMII to customer board. I use TMS320C6678 with SEED XDS560v2 USB Emulator and the Alaska Ultra 88E1111 Gigabit Ethernet Transceiver.
    My PLL Boot Configuration is Input Clock Freq (MHz) 122.88, PLLD 28 PLLM 471 DSP Freq 999.989 (MHz) (SPRS691D - April2013) topic 2.5.4 PLL Boot Configuratiopn Settings
    I make next set SGMII_SERDES_CGFPLL register -


    STD 0
    CLKBYP 00
    LOOP_BWIDTH 0
    SLEEPPLL 0
    VRANGE 1
    ENDIVCLK 0
    MPY 1000000 //48
    ENPLL 1
    (SPRUGV9D—June 2013)
    SGMII_SERDES_CFGRX(0-1)
    LOOPBACK 00
    ENOC 1
    EQ 1111 // 50 MHz
    CDR 000
    LOS 000
    ALIGN 01
    TERM 100 //4
    INVPAIR 0
    RATE 10 // 2 - Quater Rate
    BUSWIDTH 0
    ENRX 1


    SGMII_SERDES_CFGTX(0-1)
    LOOPBACK 00
    RDTCT 00
    ENIDL 0
    MYSNC 1
    DEMPHASIS 0000
    SWING 1000 //8
    CM 1
    INVPAIR 0
    RATE 10 // 2 - Quater Rate
    BUSWIDTH 000
    ENTX 1

    My procedure initialization is:
    static void _init_pll()
    {
    u32 pllst;
    _set_pll(1,52,1);
    _set_rx(1, 2, 4, 1, 12, 1);
    _set_tx(1, 2, 1, 8, 1);
    /* Unlock the chip configuration registers to allow SGMII SERDES registers to
    * be written */
    CSL_BootCfgUnlockKicker();
    CSL_BootCfgSetSGMIIConfigPLL(pll.data);
    #ifdef deb_config_pll
    CSL_BootCfgGetSGMIIConfigPLL(&pll.data);
    CSL_BootCfgGetSGMIISERDESStatus(&serdes_sts.data);
    #endif
    s32 cnt = -1;
    do
    {
    cnt++;
    CSL_BootCfgGetSGMIISERDESStatus(&pllst);
    }
    while((pllst & 0x00000001) == 0);
    CSL_BootCfgSetSGMIIRxConfig(0, rx.data);
    #ifdef deb_config_pll
    CSL_BootCfgSetSGMIIRxConfig(0, rx.data);
    CSL_BootCfgGetSGMIISERDESStatus(&serdes_sts.data);
    #endif

    CSL_BootCfgSetSGMIITxConfig(0, tx.data);
    #ifdef deb_config_pll
    CSL_BootCfgGetSGMIITxConfig(0, &tx.data);
    CSL_BootCfgGetSGMIISERDESStatus(&serdes_sts.data);
    #endif

    CSL_BootCfgSetSGMIIRxConfig(1, rx.data);
    CSL_BootCfgSetSGMIITxConfig(1, tx.data);
    #ifdef deb_config_pll
    CSL_BootCfgGetSGMIIRxConfig(1, &rx.data);
    CSL_BootCfgGetSGMIITxConfig(1, &tx.data);
    CSL_BootCfgGetSGMIISERDESStatus(&serdes_sts.data);
    #endif
    CSL_BootCfgLockKicker();
    #ifdef deb_config_pll
    CSL_BootCfgGetSGMIISERDESStatus(&serdes_sts.data);
    #endif
    }

    Before initialzation SGMII_SERDES_STS is
    RDTCTIP1 0
    TX_TESTFAIL1 0
    OCIP1 0
    LOSTDTCT1 0
    SYNC1 1
    RX_TESTFAIL1 0
    RDTCTIP0 1
    TX_TESTFAIL0 0
    OCIP0 0
    LOSTDTCT0 0
    SYNC0 1
    RX_TESTFAIL0 0
    LOCK 1


    After initialzation SGMII_SERDES_STS is
    RDTCTIP1 0
    TX_TESTFAIL1 0
    OCIP1 0
    LOSTDTCT1 0
    SYNC1 0
    RX_TESTFAIL1 0
    RDTCTIP0 1
    TX_TESTFAIL0 0
    OCIP0 0
    LOSTDTCT0 0
    SYNC0 0
    RX_TESTFAIL0 0
    LOCK 1
    As I understand it is indicate - I have error to initialize PLL?

  • Dear Oleg,

    In which mode you are operating the SGMII ?

    Master or slave mode ?

    /* Hold the port in soft reset and set up

    * the SGMII control register:

    * (1) Enable Master Mode (default)

    * (2) Enable Auto-negotiation

    */

    CSL_SGMII_startRxTxSoftReset(id);

    CSL_SGMII_disableMasterMode(id);

    You have commented it as "Enabling master mode" but code was for "disable master mode"

    Please make sure.

    Can you please try the below code ?

    static void _init_port(u32 id)
    {
    CSL_SGMII_ADVABILITY cfg = { 0 };
    CSL_SGMII_STATUS status = { 0 };
    
    /* reset SGMII */
    CSL_SGMII_doSoftReset(id);
    while(CSL_SGMII_getSoftResetStatus(id) != 0);
    
    /* Hold the port in soft reset and set up
    * the SGMII control register:
    * (1) Disable Master Mode (default)
    * (2) Enable Auto-negotiation
    */
    CSL_SGMII_startRxTxSoftReset(id);
    CSL_SGMII_disableMasterMode(id);
    CSL_SGMII_enableAutoNegotiation (id);
    CSL_SGMII_endRxTxSoftReset (id);
    
    /* Setup the Advertised Ability register for this port:
    * (1) Enable Full duplex mode
    * (2) Enable Auto Negotiation
    */
    cfg.linkSpeed = CSL_SGMII_100_MBPS;
    cfg.duplexMode = CSL_SGMII_FULL_DUPLEX;
    CSL_SGMII_setAdvAbility(id, &cfg);
    
            do
            {
                CSL_SGMII_getStatus(id, &status);
            } while (status.bIsLinkUp != 1);
    
            /* Wait for SGMII Autonegotiation to complete without error */
            do
            {
                CSL_SGMII_getStatus(id, &status);
                if (status.bIsAutoNegError != 0)
                    return; /* This is an error condition */
            } while (status.bIsAutoNegComplete != 1);
    		
    		
        /* All done with configuration. Return Now. */
        return;
    
    }	

  • Hi Titus,

    Thank you for your answer. I insert your code in my application. Unfortunately result is not changed.

    State of registers SGMII step by step:

    Aftrer power on (_init_psc)

    After init pll

    After init MDIO

    Nexr - init port

    After  CSL_SGMII_doSoftReset(id)

    After CSL_SGMII_startRxTxSoftReset(id)

    After  CSL_SGMII_enableAutoNegotiation(id);

    Before CSL_SGMII_setAdvAbility(id, &cfg);

    After CSL_SGMII_setAdvAbility(id, &cfg);

    And Chaos - value into MR_LP_ADV_ABILITY 



    Where I do errors?

    Best regards,

       Oleg

  • In case if anyone is interested in the solution of this problem, it is located in separate forum post: e2e.ti.com/.../491892
  • It's brillianty!

    Thank you very match!

    Best regards,

       Oleg