Skip to content

Commit ed0520c

Browse files
committed
Ethernet and build rework
1 parent 82279f4 commit ed0520c

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

targets/ESP32/CMakePresets.json

+12
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,18 @@
11221122
"name": "ESP32_S2_UART",
11231123
"displayName": "ESP32_S2_UART",
11241124
"configurePreset": "ESP32_S2_UART"
1125+
},
1126+
{
1127+
"inherits": "base-user",
1128+
"name": "ESP32_P4_UART",
1129+
"displayName": "ESP32_P4_UART",
1130+
"configurePreset": "ESP32_P4_UART"
1131+
},
1132+
{
1133+
"inherits": "base-user",
1134+
"name": "ESP32_P4_USB",
1135+
"displayName": "ESP32_P4_USB",
1136+
"configurePreset": "ESP32_P4_USB"
11251137
}
11261138
]
11271139
}

targets/ESP32/_Network/NF_ESP32_Ethernet.cpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,28 @@ esp_err_t NF_ESP32_InitialiseEthernet(uint8_t *pMacAdr)
159159

160160
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
161161

162-
ESP_LOGI(TAG, "Ethernet mdio %d mdc %d\n", ETH_MDIO_GPIO, ETH_MDC_GPIO);
163-
164162
// Reserve all pins used by ethernet interface
165163
CPU_GPIO_ReservePin(esp32_emac_config.smi_gpio.mdio_num, true); // MDIO
164+
CPU_GPIO_ReservePin(esp32_emac_config.smi_gpio.mdc_num, true); // MDC
165+
166+
#if SOC_EMAC_USE_MULTI_IO_MUX || SOC_EMAC_MII_USE_GPIO_MATRIX
167+
// ESP32_P4 with Ethernet
168+
const eth_mac_rmii_gpio_config_t &rmii = esp32_emac_config.emac_dataif_gpio.rmii;
169+
CPU_GPIO_ReservePin(rmii.txd0_num, true);
170+
CPU_GPIO_ReservePin(rmii.tx_en_num, true);
171+
CPU_GPIO_ReservePin(rmii.txd1_num, true);
172+
CPU_GPIO_ReservePin(rmii.rxd0_num, true);
173+
CPU_GPIO_ReservePin(rmii.rxd1_num, true);
174+
CPU_GPIO_ReservePin(rmii.crs_dv_num,true);
175+
#else
176+
// ESP32 with Ethernet
166177
CPU_GPIO_ReservePin(19, true); // TXD0
167178
CPU_GPIO_ReservePin(21, true); // TX_EN
168179
CPU_GPIO_ReservePin(22, true); // TXD1
169-
CPU_GPIO_ReservePin(esp32_emac_config.smi_gpio.mdc_num, true); // MDC
170180
CPU_GPIO_ReservePin(25, true); // RXD0
171181
CPU_GPIO_ReservePin(26, true); // RXD1
172182
CPU_GPIO_ReservePin(27, true); // CRS_DV
183+
#endif
173184

174185
// Define PHY to use with internal Ethernet
175186
#if defined(ESP32_ETHERNET_PHY_IP101)

0 commit comments

Comments
 (0)