MPC5746R RMII loopback

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5746R RMII loopback

421 Views
flyskyr丶
Contributor III

   Hi,

   When using FEC module in MPC5746R, I get a problem .

   It's fine to use loopback mode when I configure that:

FEC.TCR.R = 0x00000004;

FEC.RCR.R = 0x05EE0001;

   but not works when I using RMII loopback,:

FEC.TCR.R = 0x00000004;

FEC.RCR.R = 0x05EE040C;

other same configuration:

int ENET_Init(void) {
int i, result = 1;

#if !USE_LOOPBACK
ENET_PadConfig(); // 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;//base
//SIUL2.SCR0[0].B.FEC_MODE = 0; //1:set pad is MII-Lite mode; 0 is RMII mode
//FEC.RCR.R = 0x05EE0400;
#elif FEC_RMII
// Set in RMII mode with full frame size 10Mbps
//FEC.RCR.R = 0x05EE000C;//100M
FEC.RCR.R = 0x05EE020C;//base
//FEC.RCR.R = 0x05EE040C;
SIUL2.SCR0[0].B.FEC_MODE = 0; //RMII

// Set RMII speed - operation at 50Mhz /5*2
// FEC.MSCR.B.MII_SPEED = 0x5;
FEC.MSCR.B.MII_SPEED = 0xA;

#endif

// Enable interrupt
FEC.EIMR.R = 0x02000000;
//set priority
INTC_0.PSR[219].R = 0x4000 | 0x1E;
//INTC_0.PSR[219].R = 0xF00A;

// 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);

#if !USE_LOOPBACK
// Configure the PHY
initFecPhy();
#endif
// Flag descriptors available to allow reception
FEC.RDAR.R = 0x0100000;
return result;
}

I want to test my RMII configuration. Can you tell me the right configuration.

Thank you !

Tags (1)
0 Kudos
0 Replies