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.

6472 EMAC configured for RGMII not generating Tx clock at 125 MHz

Hi,

I am trying to run the EMAC loop-back example on a custom/reference board.

I turned off the MDIO flag in emac driver configuration, since we have an FPGA that sends ethernet packets to the DSP over RGMII.

Also I have turned off the emac loop-back. The PLL initialization is exactly the same as in the evm6472.gel .

 

The DSP provides a reference clock of 125MhZ to FPGA. The FPGA in-turn provides 125Mhz clock on the RGRXC pin to the DSP.

But once I do an EMAC Open, the DSP's Tx clock i.e RGTXC falls to 2.5Mhz.

Can you tell me what could be going wrong after EMAC_Open()?

Also, when I try to run the helloworld example that is part of MCSDK1.0, I do not see any Rx interrupts generated on the reference board.

 

Any help will be appreciated. I am copying the EMAC init code below.

 

Thanks,

Arun

 

 

     ecfg.EMACCommonConfig.UseMdio = 0;
     ecfg.EMACCommonConfig.CoreNum = 0; /* core 0 is master core in terms of EMAC */
     ecfg.EMACCommonConfig.PktMTU = 10240;

    /* Setup the EMAC configuration */

 ecfg.EMACCommonConfig.ModeFlags      =EMAC_CONFIG_MODEFLG_FULLDUPLEX         |
                                      EMAC_CONFIG_MODEFLG_GMIIEN             |
                                      EMAC_CONFIG_MODEFLG_GIGABIT            |
                                      EMAC_CONFIG_MODEFLAG_GIGFORCE  |
                                      EMAC_CONFIG_MODEFLG_RGMIIEN;
  ecfg.EMACCommonConfig.ModeFlags    |= EMAC_PKT_FLAGS_HASCRC;

    ecfg.EMACCommonConfig.MdioModeFlags =  MDIO_MODEFLG_FD1000;
/* $$$ end for local loopback... */


    switch(coreNum)
    {
        default:
        case 0:
            ecfg.EMACCoreConfig.ChannelInfo.TxChanEnable = 1;
            ecfg.EMACCoreConfig.ChannelInfo.RxChanEnable = 1;
        break;
        case 1:
            ecfg.EMACCoreConfig.ChannelInfo.TxChanEnable = 2;
            ecfg.EMACCoreConfig.ChannelInfo.RxChanEnable = 2;
        break;
         case 2:
            ecfg.EMACCoreConfig.ChannelInfo.TxChanEnable = 4;
            ecfg.EMACCoreConfig.ChannelInfo.RxChanEnable = 4;
        break; 
         case 3:
            ecfg.EMACCoreConfig.ChannelInfo.TxChanEnable = 8;
            ecfg.EMACCoreConfig.ChannelInfo.RxChanEnable = 8;
        break;
         case 4:
            ecfg.EMACCoreConfig.ChannelInfo.TxChanEnable = 0x10;
            ecfg.EMACCoreConfig.ChannelInfo.RxChanEnable = 0x10;
        break;
         case 5:
            ecfg.EMACCoreConfig.ChannelInfo.TxChanEnable = 0x20;
            ecfg.EMACCoreConfig.ChannelInfo.RxChanEnable = 0x20;
        break;          
    }

    ecfg.EMACCoreConfig.RxMaxPktPool              = 8;
    ecfg.EMACCoreConfig.pfcbGetPacket             = &GetPacket;
    ecfg.EMACCoreConfig.pfcbFreePacket            = &FreePacket;
    ecfg.EMACCoreConfig.pfcbRxPacket              = &RxPacket;
    ecfg.EMACCoreConfig.pfcbStatus                = &StatusUpdate;
    ecfg.EMACCoreConfig.pfcbStatistics            = &StatisticsUpdate;

    /* selects CPPI RAM for Descriptor memory */
    ecfg.EMACCoreConfig.DescBase = EMAC_DESC_BASE_CPPI;

    /*
     * For this example we'll set our EMAC address to be 00:01:02:03:04:05
     * If this were a real driver, we'd have to read the EMAC
     * address from where it is stored in hardware (board dependent)
     */
     ecfg.EMACCoreConfig.NumOfMacAddrs = 1;
     ecfg.EMACCoreConfig.MacAddr = (EMAC_AddrConfig **)
                                      malloc(ecfg.EMACCoreConfig.NumOfMacAddrs * sizeof(EMAC_AddrConfig *));

     for (j=0; j<ecfg.EMACCoreConfig.NumOfMacAddrs; j++){
         ecfg.EMACCoreConfig.MacAddr[j] = (EMAC_AddrConfig *)malloc(sizeof(EMAC_AddrConfig));
     }

        for(j=0; (Uint8)j<(ecfg.EMACCoreConfig.NumOfMacAddrs); j++){
            addrCfg = ecfg.EMACCoreConfig.MacAddr[j];
            addrCfg->ChannelNum = coreNum;
            for (i=0; i<6; i++)
            {
                addrCfg->Addr[i] = j * 0x10 + i + coreNum * 0x30;
            }
        }



//    for( i=0; i<6; i++ ) {
//        packet_sourcedata[i] = ecfg.MacAddr[coreNum][i];
//    }
   
   
    /* Enable EMAC in PSC control module */
    enableEMAC();
    // softreset MAC
    EMAC0Regs[0x174/4] = 1;
    EMAC0Regs[0x174/4] = 0;

    printf("EMAC0Regs: MACCONTROL    0x%x\n", EMAC0Regs[0x160/4]);
    printf("EMAC0Regs: MACSTATUS    0x%x\n", EMAC0Regs[0x164/4]);

    memset(&emacCore[0], 0, sizeof(EMAC_Core));
    memset(&emacPort[0], 0, sizeof(EMAC_Device));

    /* Open EMAC instance 0 (RGMII)*/
    printf("Calling EMAC_open()\n");
    hEMAC = (Handle) &emacPort[0];
    i = EMAC_open( 0, (Handle)0x12345678, &ecfg, hEMAC, (Handle)&emacCore[0]);