AnsweredAssumed Answered

Problem of Ethernet communication on MPC5606E based on FEC module

Question asked by Helen Shao on Jan 21, 2016

Dear Sir/Madam,

 

I'm now working on MPC5606E for Ethernet communication between two MPC5606EEVBs. One board is sending and the other should receive. I have written the code but it didn't work. The other board didn't receive anything. And I doubt if the board really sent out something.

 

I wonder if the FEC initialization is wrong but I'm not clear. Another question is should I initialize the PHY in the code or I just use it without any configuration because I think MPC5606E integrates BCM89810 so maybe configuration is finished in hardware?

 

Could you please help me solving the communication problem of Ethernet between two MPC5606EEVBs?

 

Many thanks in advance!

Best regards,

Helen

 

Here is my code of FEC initialization. In addition, the whole project including all codes is in the attachment.

 

int initFec()

{

    int i, result = 1;

 

#if !USE_LOOPBACK

    initFecIo();                // Initialise pads for the FEC

#endif

 

    FEC.ECR.R = 0x1;                // Start reset

    while (FEC.ECR.B.RESET) { } ;    // Wait for reset to complete

 

    FEC.EIMR.R = 0;                // Disable interrupts

    FEC.EIR.R  = 0xFFFFFFFF;    // Clear any interrupts

 

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

    {

        // Init tx and rx descriptors

        txDesc[i].status          = 0x2C00;        // Last and transmit CRC

        txDesc[i].length         = 0;

        txDesc[i].bufferPointer = txBuf;

       

        markRxDescEmpty(&rxDesc[i]);

        rxDesc[i].bufferPointer = rxBuf[i];

    }

 

    // Reset multicast fields

    FEC.GAUR.R = 0;

    FEC.GALR.R = 0;

    FEC.IAUR.R = 0;

    FEC.IALR.R = 0;

 

    // Set rx buf size

    FEC.EMRBR.R = 1536;

 

    // Point FEC to our (single) tx and rx descriptors

    FEC.ETDSR.R = (unsigned long) &txDesc;

    FEC.ERDSR.R = (unsigned long) &rxDesc;

 

    // Enable full duplex

    FEC.TCR.R = 0x00000004;

   

#if USE_LOOPBACK

    // In loopback, unset DRT and set LOOP in RCR

    FEC.RCR.R = 0x05EE0001;

#endif

 

    // Enable interrupt

    FEC.EIMR.R = 0x02000000;

 

    // Enable module

    FEC.ECR.R = 0x2;

 

    // Configure a MAC address

    FEC.PALR.R = (unsigned long)((mac[0] <<24)|(mac[1] <<16)|(mac[2] <<8)|(mac[3] <<0));

    FEC.PAUR.R = (unsigned long)(mac[4] <<24)|(mac[5] <<16);

 

   

    // Flag descriptors available to allow reception

    FEC.RDAR.R = 0x0100000;

   

    return result;

}

Original Attachment has been moved to: test.rar

Outcomes