Skip to content

Commit 42eb490

Browse files
Update F2 and F4 eth inits
1 parent baa5b76 commit 42eb490

File tree

11 files changed

+200
-499
lines changed

11 files changed

+200
-499
lines changed

connectivity/drivers/emac/TARGET_STM/TARGET_STM32F2/CMakeLists.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,4 @@
33

44
if("NUCLEO_F207ZG" IN_LIST MBED_TARGET_LABELS)
55
add_subdirectory(TARGET_NUCLEO_F207ZG)
6-
endif()
7-
8-
target_include_directories(mbed-emac
9-
PUBLIC
10-
.
11-
)
12-
13-
target_sources(mbed-emac
14-
PRIVATE
15-
stm32f2_eth_conf.c
16-
)
6+
endif()

connectivity/drivers/emac/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/stm32f2_eth_init.c

Lines changed: 66 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -29,98 +29,87 @@
2929
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030
*/
3131

32-
#ifndef USE_USER_DEFINED_HAL_ETH_MSPINIT
33-
3432
#include "stm32f2xx_hal.h"
33+
#include "PinNames.h"
3534

36-
/**
37-
* Override HAL Eth Init function
38-
*/
39-
void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
35+
void EthInitPinmappings(void)
4036
{
4137
GPIO_InitTypeDef GPIO_InitStructure;
42-
if (heth->Instance == ETH) {
4338

44-
/* Enable GPIOs clocks */
45-
__HAL_RCC_GPIOA_CLK_ENABLE();
46-
__HAL_RCC_GPIOB_CLK_ENABLE();
47-
__HAL_RCC_GPIOC_CLK_ENABLE();
48-
__HAL_RCC_GPIOG_CLK_ENABLE();
39+
/* Enable GPIOs clocks */
40+
__HAL_RCC_GPIOA_CLK_ENABLE();
41+
__HAL_RCC_GPIOB_CLK_ENABLE();
42+
__HAL_RCC_GPIOC_CLK_ENABLE();
43+
__HAL_RCC_GPIOG_CLK_ENABLE();
4944

50-
/** ETH GPIO Configuration
51-
RMII_REF_CLK ----------------------> PA1
52-
RMII_MDIO -------------------------> PA2
53-
RMII_MDC --------------------------> PC1
54-
RMII_MII_CRS_DV -------------------> PA7
55-
RMII_MII_RXD0 ---------------------> PC4
56-
RMII_MII_RXD1 ---------------------> PC5
57-
RMII_MII_RXER ---------------------> none
58-
RMII_MII_TX_EN --------------------> PG11
59-
RMII_MII_TXD0 ---------------------> PG13
60-
RMII_MII_TXD1 ---------------------> PB13
61-
*/
62-
/* Configure PA1, PA2 and PA7 */
63-
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
64-
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
65-
GPIO_InitStructure.Pull = GPIO_NOPULL;
66-
GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
67-
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
68-
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
45+
/** ETH GPIO Configuration
46+
RMII_REF_CLK ----------------------> PA1
47+
RMII_MDIO -------------------------> PA2
48+
RMII_MDC --------------------------> PC1
49+
RMII_MII_CRS_DV -------------------> PA7
50+
RMII_MII_RXD0 ---------------------> PC4
51+
RMII_MII_RXD1 ---------------------> PC5
52+
RMII_MII_RXER ---------------------> none
53+
RMII_MII_TX_EN --------------------> PG11
54+
RMII_MII_TXD0 ---------------------> PG13
55+
RMII_MII_TXD1 ---------------------> PB13
56+
*/
57+
/* Configure PA1, PA2 and PA7 */
58+
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
59+
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
60+
GPIO_InitStructure.Pull = GPIO_NOPULL;
61+
GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
62+
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
63+
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
6964

70-
/* Configure PB13 */
71-
GPIO_InitStructure.Pin = GPIO_PIN_13;
72-
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
65+
/* Configure PB13 */
66+
GPIO_InitStructure.Pin = GPIO_PIN_13;
67+
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
7368

74-
/* Configure PC1, PC4 and PC5 */
75-
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
76-
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
69+
/* Configure PC1, PC4 and PC5 */
70+
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
71+
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
7772

78-
/* Configure PG11 and PG13 */
79-
GPIO_InitStructure.Pin = GPIO_PIN_11 | GPIO_PIN_13;
80-
HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);
73+
/* Configure PG11 and PG13 */
74+
GPIO_InitStructure.Pin = GPIO_PIN_11 | GPIO_PIN_13;
75+
HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);
8176

82-
/* Enable the Ethernet global Interrupt */
83-
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
84-
HAL_NVIC_EnableIRQ(ETH_IRQn);
77+
/* Enable the Ethernet global Interrupt */
78+
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
79+
HAL_NVIC_EnableIRQ(ETH_IRQn);
8580

86-
/* Enable ETHERNET clock */
87-
__HAL_RCC_ETH_CLK_ENABLE();
88-
}
81+
/* Enable ETHERNET clock */
82+
__HAL_RCC_ETH_CLK_ENABLE();
8983
}
9084

91-
/**
92-
* Override HAL Eth DeInit function
93-
*/
94-
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
85+
void EthDeinitPinmappings()
9586
{
96-
if (heth->Instance == ETH) {
97-
/* Peripheral clock disable */
98-
__HAL_RCC_ETH_CLK_DISABLE();
87+
/* Peripheral clock disable */
88+
__HAL_RCC_ETH_CLK_DISABLE();
9989

100-
/** ETH GPIO Configuration
101-
RMII_REF_CLK ----------------------> PA1
102-
RMII_MDIO -------------------------> PA2
103-
RMII_MDC --------------------------> PC1
104-
RMII_MII_CRS_DV -------------------> PA7
105-
RMII_MII_RXD0 ---------------------> PC4
106-
RMII_MII_RXD1 ---------------------> PC5
107-
RMII_MII_RXER ---------------------> none
108-
RMII_MII_TX_EN --------------------> PG11
109-
RMII_MII_TXD0 ---------------------> PG13
110-
RMII_MII_TXD1 ---------------------> PB13
111-
*/
112-
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7);
113-
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13);
114-
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5);
115-
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_11 | GPIO_PIN_13);
90+
/** ETH GPIO Configuration
91+
RMII_REF_CLK ----------------------> PA1
92+
RMII_MDIO -------------------------> PA2
93+
RMII_MDC --------------------------> PC1
94+
RMII_MII_CRS_DV -------------------> PA7
95+
RMII_MII_RXD0 ---------------------> PC4
96+
RMII_MII_RXD1 ---------------------> PC5
97+
RMII_MII_RXER ---------------------> none
98+
RMII_MII_TX_EN --------------------> PG11
99+
RMII_MII_TXD0 ---------------------> PG13
100+
RMII_MII_TXD1 ---------------------> PB13
101+
*/
102+
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7);
103+
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13);
104+
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5);
105+
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_11 | GPIO_PIN_13);
116106

117-
/* Disable the Ethernet global Interrupt */
118-
NVIC_DisableIRQ(ETH_IRQn);
119-
}
107+
/* Disable the Ethernet global Interrupt */
108+
NVIC_DisableIRQ(ETH_IRQn);
120109
}
121110

122-
#endif /* USE_USER_DEFINED_HAL_ETH_MSPINIT */
123-
124-
// Blank, non-weak-override function to make sure the linker pulls in this file
125-
void stm32_eth_init_weak_symbol_helper()
126-
{}
111+
// Get Ethernet PHY reset pin
112+
PinName EthGetPhyResetPin(void)
113+
{
114+
return NC; // Not connected on this board
115+
}

connectivity/drivers/emac/TARGET_STM/TARGET_STM32F2/stm32f2_eth_conf.c

Lines changed: 0 additions & 61 deletions
This file was deleted.

connectivity/drivers/emac/TARGET_STM/TARGET_STM32F4/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,4 @@ if("NUCLEO_F429ZI" IN_LIST MBED_TARGET_LABELS)
55
add_subdirectory(TARGET_NUCLEO_F429ZI)
66
elseif("NUCLEO_F439ZI" IN_LIST MBED_TARGET_LABELS)
77
add_subdirectory(TARGET_NUCLEO_F439ZI)
8-
endif()
9-
10-
target_include_directories(mbed-emac
11-
PUBLIC
12-
.
13-
)
8+
endif()

connectivity/drivers/emac/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ target_include_directories(mbed-emac
88

99
target_sources(mbed-emac
1010
PRIVATE
11-
stm32f4_eth_conf.c
1211
stm32f4_eth_init.c
1312
)

connectivity/drivers/emac/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/stm32f4_eth_conf.c

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)