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.

NC_NetStop(1) -> NC_NetStart() doesn't work.(Link LEDs balck out)

I'm using  EVMC6657
BIOS.6.33.06.50
NDK 2.21.01.38
PDK 1.1.2.5

in helloworld project
Once I called NC_NetStop(1) from another task,
NC_NetStart() will called, but Link will not up.
My log is ...
[C66xx_0] Network Removed: If-1:192.168.4.20
[C66xx_0] Service Status: DHCPC    : Disabled :          : 000
[C66xx_0] emac_close core 0 port 0
[C66xx_0] emac_init: core 0, port 0, total number of channels/MAC addresses: 1/1
[C66xx_0] MAC addresses configured for channel 0:
[C66xx_0] 08-00-28-32-95-47
[C66xx_0] SGMII reset successful........
[C66xx_0] SGMII config successful........
 : Stops

Question. 1
  Any solutons, that i can now?
Question.2
 I think it's because EMAC or PHY initialize code in NDK orPDK.
 It premises EMAC, PHY  is at  after reset state.
  I know PHY is not TI device.but...
 If so,
 If I wait for future versions of PDKs, Will Ti changes pdk for this?

thank you.

  • Hi Kazunori,

    I'm trying to reproduce the problem.

    Todd

  • Hi Kazunori,

    Sorry for the late response...I saw a similar issue on a different driver and spent time looking at it, when I should have went straight to the driver you are using. So the code is stuck in the emac_open function in the following loop...correct?

            do
            {
                stat = SGMII_REGS->STATUS;
                stat = stat & 0x1;
            } while( stat != 0x1 );

    What is the value of stat?

    Todd

  • Hi, Todd.
    Thank you for your reply.

    Yes, it is stuck at the  while loop.(SPKERNEL  0,0)
    And the value of SGMII_REGS->STATUS(0x02c08914) is 0x3A.

    -Kazunori.

  • Hi, All

    stacking In [emac_drv.c]
    {
        stat = SGMII_REGS->STATUS;
        stat = stat & 0x1;
    } while( stat != 0x1 );

    Once Writing 0xC0188000(PHYREG_CONTROL_RESET) to MDIO USERACCESS0  register by CCS
    SGMII->STATUS  comes 0x003D, (10Mbps half)
    and emac starts. Receiving packets is started.
    but Issure from following ,  TX dosn't start.
       http://e2e.ti.com/support/embedded/bios/f/355/t/233326.aspx

    Probrem A: C6657's EMAC Transmitter stalls once SGMII Link Status is down.(In this chip revision)
               So SGMII Link must established before EMAC SOFT RESET.
    (^^^^ This is only my imagine)

    After this, cause of my language probrem in English.
    I can't write loggically. but theese are my making it out for present version of PDK,NDK.
    Are theese roughly correct?

    Thank you.
    -Kazunori

    ------------------------------------
    EMAC_initPHY() is called from MDIO_timerTick()
    MDIO_timerTick() caller (emac_poll() or EMAC_timerTick()) starts after emac_open()
    EMAC_commonInit() called from emac_open()

    In EMAC_commonInit()
     ECTL_REGS->SOFT_RESET = 0x01;
     while (ECTL_REGS->SOFT_RESET != 0x00000000);  /* Wait until reset has occured */

    next
        if (pEMACCommonConfig->UseMdio)
            /* Start the MII Configuration */
            MDIO_open(instNum, pEMACCommonConfig->MdioModeFlags, pEMACCommonConfig->MdioPhyAddr, &pEmacDev->MdioDev);
     
    in MDIO_open()
     starts mdio state machine
     
    [MDIO_initPHY]
     if defined (C6657) 
     following code is not done.(because once reset MDIO, Probrem A comes up)
        PHYREG_write( pd->regId, PHYREG_CONTROL, phyAddr, PHYREG_CONTROL_RESET );
        PHYREG_waitResultsAck( pd->regId, &i, &ack );
     
     
    [MDIO_initContinue]
      if target is C6657 , MDIO is not to be reset.
      So, program code dosn't change MDIO setting (doesn't re-configure).
      program code changes ONLY soft state.

    [MDIO_close]
     Even If C6657, do following.
      PHYREG_write( pd->regId, PHYREG_CONTROL, i, PHYREG_CONTROL_ISOLATE | PHYREG_CONTROL_POWERDOWN );


    AND SO..........
    In EMACInit_Core()
        ptr_device->poll        = EmacPoll;

    static void EmacPoll (NETIF_DEVICE* ptr_net_device, uint timer_tick)
    {

     ////// neither emac_poll, EMAC_timerTick are NOT called  X(
     It should be called but it doesn't work well.
     return;

    }


     

  • Hi, Todd.

    I changed MDIO_close() function in [mdio.c] in pdk.
    And NC_NetStop() works well.
    After pull ether cable , and reconnection, NC_NetStop() can re-establish emac connection.
    (ofcause , All IP Connections are shutdown ;-) 

    This is not the best solution. but second or third or... solution until slove the probrem in MIDO soft setting or EMAC re-establishing.
    Next is how do i know emac link was lost......

    thank you.

    ------- changed source --------

    void MDIO_close( Handle hMDIO )
    {
        Uint32         ltmp1;
        Uint32           i;

        MDIO_Device *pd = (MDIO_Device *)hMDIO;

        /*
         * We really don't care what state anything is in at this point,
         * but to be safe, we'll isolate all the PHY devices.
         */
    #if defined(C6474) | defined(C6457) | defined(C6472) /*| defined(C6657)*/

        ltmp1 = MDIO_REGS->ALIVE;
        for( i=0; ltmp1; i++,ltmp1>>=1 )
        {
            if( ltmp1 & 1 )
            {
                PHYREG_write( pd->regId, PHYREG_CONTROL, i, PHYREG_CONTROL_ISOLATE |
                                                 PHYREG_CONTROL_POWERDOWN );
                PHYREG_wait( pd->regId );
            }
        }
    #endif

    }

  • Hai

    Kazunori. This mail in response to your post on that you had posted on Jan 11 2013 00:06 AM. Thanks a lot for posting the fix related to PDK_C6657. This issue was a very very high priority one for my firmware delivery and with the guidance of your post i could resolve this issue in 2 minutes. I appreciate your great intent of posting the fix onto TI forum so that other people can benefit from the same. Thanks once again for the post with the fix related to PDK C6657 NC_NetStart() and NC_NetStop() calls.

    All the very best.

    Regards,

    Abiramy.R