Ejemplo n.º 1
0
unsigned long ENET_Configuration(void)
{
	unsigned long res=0;
	unsigned short tmp;

	RCC_AHBPeriphClockCmd(RCC_AHBPeriph_ETH_MAC | RCC_AHBPeriph_ETH_MAC_Tx |
	                        RCC_AHBPeriph_ETH_MAC_Rx, ENABLE);

	ETH_DeInit();
	get_mac(mac);
	ETH_MACAddressConfig(ETH_MAC_Address0, mac);
	GPIO_ETH_MediaInterfaceConfig(GPIO_ETH_MediaInterface_RMII);

	ETH_SoftwareReset();
	while(ETH_GetSoftwareResetStatus()==SET) vTaskDelayUntil( &ExLastExecutionTime, ( portTickType ) 1 / portTICK_RATE_MS );
	ETH_StructInit(&ETH_InitStructure);


	ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Enable;
	ETH_InitStructure.ETH_Watchdog = ETH_Watchdog_Disable;
	ETH_InitStructure.ETH_Jabber = ETH_Jabber_Disable;
	ETH_InitStructure.ETH_JumboFrame = ETH_JumboFrame_Disable;
	ETH_InitStructure.ETH_InterFrameGap = ETH_InterFrameGap_64Bit;
	ETH_InitStructure.ETH_CarrierSense = ETH_CarrierSense_Enable;
	ETH_InitStructure.ETH_Speed = ETH_Speed_10M;
	ETH_InitStructure.ETH_ReceiveOwn = ETH_ReceiveOwn_Disable;
	ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
	ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex;
	ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
	ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
	ETH_InitStructure.ETH_BackOffLimit = ETH_BackOffLimit_10;
	ETH_InitStructure.ETH_DeferralCheck = ETH_DeferralCheck_Disable;
	ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
	ETH_InitStructure.ETH_PassControlFrames = ETH_PassControlFrames_ForwardPassedAddrFilter;
	ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
	ETH_InitStructure.ETH_DestinationAddrFilter = ETH_DestinationAddrFilter_Normal;
	ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
	ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
	ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
	ETH_InitStructure.ETH_RxDMABurstLength = ETH_RxDMABurstLength_32Beat;
	ETH_InitStructure.ETH_TxDMABurstLength = ETH_TxDMABurstLength_32Beat;
	ETH_InitStructure.ETH_FlushReceivedFrame = ETH_FlushReceivedFrame_Enable;
	ETH_InitStructure.ETH_SecondFrameOperate = ETH_SecondFrameOperate_Enable;
	ETH_InitStructure.ETH_FixedBurst = ETH_FixedBurst_Enable;
	res = ETH_Init(&ETH_InitStructure, PHY_ADDRESS);

	ETH_DMAITConfig(ETH_DMA_IT_NIS | ETH_DMA_IT_R | ETH_DMA_IT_T, ENABLE);
	for(tmp=0;tmp<ETH_RXBUFNB;tmp++) Rx_Buff[tmp] = (unsigned long)&ETH_RX[tmp][0];
	for(tmp=0;tmp<ETH_TXBUFNB;tmp++) Tx_Buff[tmp] = (unsigned long)&ETH_TX[tmp][0];
	ETH_DMATxDescChainInit(DMATxDscrTab, (unsigned char*)Tx_Buff, ETH_TXBUFNB);
	ETH_DMARxDescChainInit(DMARxDscrTab, (unsigned char*)Rx_Buff, ETH_RXBUFNB);
	for(tmp=0;tmp<ETH_RXBUFNB;tmp++){ETH_DMARxDescReceiveITConfig(DMARxDscrTab+tmp, ENABLE);}
	ETH_Start();
	ETH_ResumeDMAReception();
	return(res);
}
Ejemplo n.º 2
0
/**
  * @brief  Configures the Ethernet Interface
  * @param  None
  * @retval None
  */
void Ethernet_Configuration(void)
{
	  ETH_InitTypeDef ETH_InitStructure;

	  GPIO_ETH_MediaInterfaceConfig(GPIO_ETH_MediaInterface_MII);

	  /* Reset ETHERNET on AHB Bus */
	  ETH_DeInit();

	  /* Software reset */
	  ETH_SoftwareReset();

	  /* Wait for software reset */
	  while(ETH_GetSoftwareResetStatus()==SET);

	  /* ETHERNET Configuration ------------------------------------------------------*/
	  /* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */
	  ETH_StructInit(&ETH_InitStructure);

	  /* Fill ETH_InitStructure parametrs */
	  /*------------------------   MAC   -----------------------------------*/
	  ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Enable  ;
	  //ETH_InitStructure.ETH_Speed = ETH_Speed_100M;
	  ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
	  //ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex;
	  ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
	  ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
	  ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
	  ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
	  ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
	  ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
	  ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
	  /* Configure ETHERNET */
	  ETH_Init(&ETH_InitStructure, PHY_ADDRESS);

		ETH_DMAITConfig(ETH_DMA_IT_NIS | ETH_DMA_IT_R, ENABLE);
}
Ejemplo n.º 3
0
/**
  * @brief  Configures the Ethernet Interface
  * @param  None
  * @retval None
  */
void Ethernet_Configuration(void)
{
  ETH_InitTypeDef ETH_InitStructure;

  /* MII/RMII Media interface selection ------------------------------------------*/
#ifdef MII_MODE /* Mode MII with STM3210C-EVAL  */
  GPIO_ETH_MediaInterfaceConfig(GPIO_ETH_MediaInterface_MII);

  /* Get HSE clock = 25MHz on PA8 pin (MCO) */
  RCC_MCOConfig(RCC_MCO_HSE);

#elif defined RMII_MODE  /* Mode RMII with STM3210C-EVAL */
  GPIO_ETH_MediaInterfaceConfig(GPIO_ETH_MediaInterface_RMII);

//  /* Set PLL3 clock output to 50MHz (25MHz /5 *10 =50MHz) */
//  RCC_PLL3Config(RCC_PLL3Mul_10);
//  /* Enable PLL3 */
//  RCC_PLL3Cmd(ENABLE);
//  /* Wait till PLL3 is ready */
//  while (RCC_GetFlagStatus(RCC_FLAG_PLL3RDY) == RESET)
//  {}
//
//  /* Get PLL3 clock on PA8 pin (MCO) */
//  RCC_MCOConfig(RCC_MCO_PLL3CLK);
#endif

  /* Reset ETHERNET on AHB Bus */
  ETH_DeInit();

  /* Software reset */
  ETH_SoftwareReset();

  /* Wait for software reset */
  while (ETH_GetSoftwareResetStatus() == SET);

  /* ETHERNET Configuration ------------------------------------------------------*/
  /* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */
  ETH_StructInit(&ETH_InitStructure);

  /* Fill ETH_InitStructure parametrs */
  /*------------------------   MAC   -----------------------------------*/
  ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Enable  ;
  ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
  ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
  ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
  ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Disable;
  ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Enable;
  ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
  ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
  ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
#ifdef CHECKSUM_BY_HARDWARE
  ETH_InitStructure.ETH_ChecksumOffload = ETH_ChecksumOffload_Enable;
#endif

  /*------------------------   DMA   -----------------------------------*/  
  
  /* When we use the Checksum offload feature, we need to enable the Store and Forward mode: 
  the store and forward guarantee that a whole frame is stored in the FIFO, so the MAC can insert/verify the checksum, 
  if the checksum is OK the DMA can handle the frame otherwise the frame is dropped */
  ETH_InitStructure.ETH_DropTCPIPChecksumErrorFrame = ETH_DropTCPIPChecksumErrorFrame_Enable; 
  ETH_InitStructure.ETH_ReceiveStoreForward = ETH_ReceiveStoreForward_Enable;         
  ETH_InitStructure.ETH_TransmitStoreForward = ETH_TransmitStoreForward_Enable;     
 
  ETH_InitStructure.ETH_ForwardErrorFrames = ETH_ForwardErrorFrames_Disable;       
  ETH_InitStructure.ETH_ForwardUndersizedGoodFrames = ETH_ForwardUndersizedGoodFrames_Disable;   
  ETH_InitStructure.ETH_SecondFrameOperate = ETH_SecondFrameOperate_Enable;                                                          
  ETH_InitStructure.ETH_AddressAlignedBeats = ETH_AddressAlignedBeats_Enable;      
  ETH_InitStructure.ETH_FixedBurst = ETH_FixedBurst_Enable;                
  ETH_InitStructure.ETH_RxDMABurstLength = ETH_RxDMABurstLength_32Beat;          
  ETH_InitStructure.ETH_TxDMABurstLength = ETH_TxDMABurstLength_32Beat;                                                                 
  ETH_InitStructure.ETH_DMAArbitration = ETH_DMAArbitration_RoundRobin_RxTx_2_1;

  /* Configure Ethernet */
  ETH_Init(&ETH_InitStructure, PHY_ADDRESS);
  
  /* Enable the Ethernet Rx Interrupt */
  ETH_DMAITConfig(ETH_DMA_IT_NIS | ETH_DMA_IT_R, ENABLE);  
}
Ejemplo n.º 4
0
/**
  * @brief  Configures the DP83848V : Ethernet RMII Interface.
  * @param  None
  * @retval None
  */
void ET_STM32_ETH_Configuration(void)
{
  vu32 Value = 0;
  GPIO_InitTypeDef  GPIO_InitStructure;
  ETH_InitTypeDef   ETH_InitStructure;
  
  /* Enable ETHERNET Clock  */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_ETH_MAC    | 
                        RCC_AHBPeriph_ETH_MAC_Tx |
                        RCC_AHBPeriph_ETH_MAC_Rx, ENABLE);

  // Start Initial GPIO For Interface DP83848V
  // Initial ET-STM32F ARM KIT Ethernet Interface = RMII Mode
  // PA1  <- ETH_RMII_REF_CLK(Default)
  // PA2  -> ETH_RMII_MDIO(Default)
  // PA8  -> MCO(Default)
  // PB11 -> ETH_RMII_TXEN(Default)
  // PB12 -> ETH_RMII_TXD0(Default)
  // PB13 -> ETH_RMII_TXD1(Default)
  // PC1  -> ETH_RMII_MDC(Default)
  // PD8  <- ETH_RMII_RXDV(Remap)
  // PD9  <- ETH_RMII_RXD0(Remap)
  // PD10 <- ETH_RMII_RXD1(Remap)

  // Configure PA2 as alternate function push-pull 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;				//PA2 = ETH_RMII_MDIO
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  // Configure PC1 as alternate function push-pull 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;				//PC1 = ETH_RMII_MDC
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_Init(GPIOC, &GPIO_InitStructure);

  // Configure PB11, PB12 and PB13 as alternate function push-pull 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 |			//PB11 = ETH_RMII_TXEN 
                                GPIO_Pin_12 | 		  	//PB12 = ETH_RMII_TXD0
								GPIO_Pin_13;			//PB13 = ETH_RMII_TXD1
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_Init(GPIOB, &GPIO_InitStructure);
  
  // Configure PA1 as input 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;				//PA1 = ETH_RMII_REF_CLK
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  // ETHERNET pins remapp in ET-STM32F ARM KIT board: RX_DV and RxD[1:0] 
  // PD8=CRS_DV(RMII Remap)
  // PD9=RXD0(RMII Remap)
  // PD10=RXD1(RMII Remap)
  GPIO_PinRemapConfig(GPIO_Remap_ETH, ENABLE);

  // Configure PD8, PD9, PD10 as input 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | 			//PD8  = ETH_RMII_RX_DV
  							    GPIO_Pin_9 | 			//PD9  = ETH_RMII_RXD0
								GPIO_Pin_10;			//PD10 = ETH_RMII_RXD1
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  GPIO_Init(GPIOD, &GPIO_InitStructure);

  
  /* Start of Config MCO Clock = 50MHz on PA8 */
  // Configure MCO (PA8) as alternate function push-pull 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; 			//PA8 = MCO
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  // set PLL3 clock output to 50MHz (25MHz / 5 * 10 = 50MHz) 
  RCC_PLL3Config(RCC_PLL3Mul_10);

  // Enable PLL3 
  RCC_PLL3Cmd(ENABLE);

  // Wait till PLL3 is ready 
  while (RCC_GetFlagStatus(RCC_FLAG_PLL3RDY) == RESET){}

  // Get clock PLL3 clock on PA8 pin 
  RCC_MCOConfig(RCC_MCO_PLL3CLK); 
  /*End of Initial MCO Clock = 50MHz on PA8	*/
  
  //Initial Ethernet Interface = RMII Mode      
  GPIO_ETH_MediaInterfaceConfig(GPIO_ETH_MediaInterface_RMII);
   
  /* Reset ETHERNET on AHB Bus */
  ETH_DeInit();
  
  /* Software reset */ 
  ETH_SoftwareReset();
  
  /* Wait for software reset */
  while(ETH_GetSoftwareResetStatus()==SET);

  /* ETHERNET Configuration ------------------------------------------------------*/
  /* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */
  ETH_StructInit(&ETH_InitStructure);
  
  /* Fill ETH_InitStructure parametrs */
  /*------------------------   MAC   -----------------------------------*/
  ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Enable  ;  

  //ETH_InitStructure.ETH_Speed = ETH_Speed_100M;  //Test 100 MHz

  ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;              

  //ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex;  //Test

  ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;                                                                                  
  ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;                                                                                                                                                                        
  ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;                                                                                                       
  ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;      
  ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;                                                             
  ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;      
  ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;                        

  /* Configure ETHERNET */
  Value = ETH_Init(&ETH_InitStructure, PHY_ADDRESS); 
}
Ejemplo n.º 5
0
void stm32f107EthInitGpio(NetInterface *interface)
{
   GPIO_InitTypeDef GPIO_InitStructure;

//STM3210C-EVAL evaluation board?
#if defined(USE_STM3210C_EVAL)
   //Enable AFIO clock
   RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);

   //Enable GPIO clocks
   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |
      RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD, ENABLE);

   //Configure MCO (PA8) as an output
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
   GPIO_Init(GPIOA, &GPIO_InitStructure);

   //Configure MCO pin to output the HSE clock (25MHz)
   RCC_MCOConfig(RCC_MCO_HSE);

   //Select MII interface mode
   GPIO_ETH_MediaInterfaceConfig(GPIO_ETH_MediaInterface_MII);

   //Configure MII_MDIO (PA2)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
   GPIO_Init(GPIOA, &GPIO_InitStructure);

   //Configure MII_PPS_OUT (PB5), ETH_MII_TXD3 (PB8), MII_TX_EN (PB11),
   //MII_TXD0 (PB12) and MII_TXD1 (PB13)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
   GPIO_Init(GPIOB, &GPIO_InitStructure);

   //Configure MII_MDC (PC1) and MII_TXD2 (PC2)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
   GPIO_Init(GPIOC, &GPIO_InitStructure);

   //Configure ETH_MII_CRS (PA0), ETH_MII_RX_CLK (PA1) and ETH_MII_COL (PA3)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_3;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
   GPIO_Init(GPIOA, &GPIO_InitStructure);

   //Configure ETH_MII_RX_ER (PB10)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
   GPIO_Init(GPIOB, &GPIO_InitStructure);

   //Configure ETH_MII_TX_CLK (PC3)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
   GPIO_Init(GPIOC, &GPIO_InitStructure);

   //Configure ETH_MII_RX_DV (PD8), ETH_MII_RXD0 (PD9), ETH_MII_RXD1 (PD10),
   //ETH_MII_RXD2 (PD11) and ETH_MII_RXD3 (PD12)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
   GPIO_Init(GPIOD, &GPIO_InitStructure);

   //Remap Ethernet pins
   GPIO_PinRemapConfig(GPIO_Remap_ETH, ENABLE);

//STM32-P107 evaluation board?
#elif defined(USE_STM32_P107)
   //Enable AFIO clock
   RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);

   //Enable GPIO clocks
   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |
      RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC, ENABLE);

   //Configure MCO (PA8) as an output
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
   GPIO_Init(GPIOA, &GPIO_InitStructure);

   //Configure PLL3 to output a 50MHz clock
   RCC_PLL3Config(RCC_PLL3Mul_10);
   //Enable PLL3
   RCC_PLL3Cmd(ENABLE);

   //Wait for the PLL3 to lock
   while(RCC_GetFlagStatus(RCC_FLAG_PLL3RDY) == RESET);

   //Configure MCO pin to output the PLL3 clock
   RCC_MCOConfig(RCC_MCO_PLL3CLK);

   //Select RMII interface mode
   GPIO_ETH_MediaInterfaceConfig(GPIO_ETH_MediaInterface_RMII);

   //Configure ETH_MDIO (PA2)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
   GPIO_Init(GPIOA, &GPIO_InitStructure);

   //Configure ETH_RMII_TX_EN (PB11), ETH_RMII_TXD0 (PB12) and ETH_RMII_TXD1 (PB13)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
   GPIO_Init(GPIOB, &GPIO_InitStructure);

   //Configure ETH_MDC (PC1)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
   GPIO_Init(GPIOC, &GPIO_InitStructure);

   //Configure ETH_RMII_REF_CLK (PA1) and ETH_RMII_CRS_DV (PA7)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_7;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
   GPIO_Init(GPIOA, &GPIO_InitStructure);

   //Configure ETH_RMII_RXD0 (PC4) and ETH_RMII_RXD1 (PC5)
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
   GPIO_Init(GPIOC, &GPIO_InitStructure);

   //Do not remap Ethernet pins
   GPIO_PinRemapConfig(GPIO_Remap_ETH, DISABLE);
#endif
}