-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the IPV4 feature was already enabled in an earlier commit but the mbed 5 ethernet initialisation was missing
- Loading branch information
1 parent
53677de
commit 2934ae4
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
...-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F769NI/stm32f7_eth_init.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#include "stm32f7xx_hal.h" | ||
|
||
/** | ||
* Override HAL Eth Init function | ||
*/ | ||
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) | ||
{ | ||
GPIO_InitTypeDef GPIO_InitStructure; | ||
if (heth->Instance == ETH) { | ||
|
||
/* Enable GPIOs clocks */ | ||
__HAL_RCC_GPIOA_CLK_ENABLE(); | ||
__HAL_RCC_GPIOC_CLK_ENABLE(); | ||
__HAL_RCC_GPIOD_CLK_ENABLE(); | ||
__HAL_RCC_GPIOG_CLK_ENABLE(); | ||
|
||
/** ETH GPIO Configuration | ||
RMII_REF_CLK ----------------------> PA1 | ||
RMII_MDIO -------------------------> PA2 | ||
RMII_MDC --------------------------> PC1 | ||
RMII_MII_CRS_DV -------------------> PA7 | ||
RMII_MII_RXD0 ---------------------> PC4 | ||
RMII_MII_RXD1 ---------------------> PC5 | ||
RMII_MII_RXER ---------------------> PD5 | ||
RMII_MII_TX_EN --------------------> PG11 | ||
RMII_MII_TXD0 ---------------------> PG13 | ||
RMII_MII_TXD1 ---------------------> PG14 | ||
*/ | ||
/* Configure PA1, PA2 and PA7 */ | ||
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH; | ||
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; | ||
GPIO_InitStructure.Pull = GPIO_NOPULL; | ||
GPIO_InitStructure.Alternate = GPIO_AF11_ETH; | ||
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7; | ||
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); | ||
|
||
/* Configure PC1, PC4 and PC5 */ | ||
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5; | ||
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure); | ||
|
||
/* Configure PD5 */ | ||
GPIO_InitStructure.Pin = GPIO_PIN_5; | ||
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure); | ||
|
||
/* Configure PG11, PG13 and PG14 */ | ||
GPIO_InitStructure.Pin = GPIO_PIN_11 | GPIO_PIN_13 | GPIO_PIN_14; | ||
HAL_GPIO_Init(GPIOG, &GPIO_InitStructure); | ||
|
||
/* Enable the Ethernet global Interrupt */ | ||
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0); | ||
HAL_NVIC_EnableIRQ(ETH_IRQn); | ||
|
||
/* Enable ETHERNET clock */ | ||
__HAL_RCC_ETH_CLK_ENABLE(); | ||
} | ||
} | ||
|
||
/** | ||
* Override HAL Eth DeInit function | ||
*/ | ||
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) | ||
{ | ||
if (heth->Instance == ETH) { | ||
/* Peripheral clock disable */ | ||
__HAL_RCC_ETH_CLK_DISABLE(); | ||
|
||
/** ETH GPIO Configuration | ||
RMII_REF_CLK ----------------------> PA1 | ||
RMII_MDIO -------------------------> PA2 | ||
RMII_MDC --------------------------> PC1 | ||
RMII_MII_CRS_DV -------------------> PA7 | ||
RMII_MII_RXD0 ---------------------> PC4 | ||
RMII_MII_RXD1 ---------------------> PC5 | ||
RMII_MII_RXER ---------------------> PD5 | ||
RMII_MII_TX_EN --------------------> PG11 | ||
RMII_MII_TXD0 ---------------------> PG13 | ||
RMII_MII_TXD1 ---------------------> PG14 | ||
*/ | ||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7); | ||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5); | ||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_5); | ||
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_11 | GPIO_PIN_13 | GPIO_PIN_14); | ||
|
||
/* Disable the Ethernet global Interrupt */ | ||
NVIC_DisableIRQ(ETH_IRQn); | ||
} | ||
} |