Closed
Description
Related area
Mac Address Ethernet W5500 SPI
Hardware specification
ESP32 DevKitC
Is your feature request related to a problem?
Currently the MAC address configuration in the ETH library happens internally, so the user cannot decide which MAC address he wants to use.
Describe the solution you'd like
I want it to be possible to change the MAC address through the begin function of the ETH.h library.
Describe alternatives you've considered
The solution would be to create a new method for the ETH library. See below:
File ETH.h, line 125:
BEFORE:
#if ETH_SPI_SUPPORTS_CUSTOM
bool begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t spi_freq_mhz = ETH_PHY_SPI_FREQ_MHZ);
#endif
AFTER:
#if ETH_SPI_SUPPORTS_CUSTOM
bool begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t spi_freq_mhz = ETH_PHY_SPI_FREQ_MHZ);
bool begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t *mac_addr, uint8_t spi_freq_mhz = ETH_PHY_SPI_FREQ_MHZ);
#endif
BEFORE:
#if ETH_SPI_SUPPORTS_CUSTOM
bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t spi_freq_mhz) {
return beginSPI(type, phy_addr, nullptr, cs, irq, rst, &spi, -1, -1, -1, SPI2_HOST, spi_freq_mhz);
}
#endif
AFTER:
#if ETH_SPI_SUPPORTS_CUSTOM
bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t spi_freq_mhz) {
return beginSPI(type, phy_addr, nullptr, cs, irq, rst, &spi, -1, -1, -1, SPI2_HOST, spi_freq_mhz);
}
bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t *mac_addr, uint8_t spi_freq_mhz) {
return beginSPI(type, phy_addr, mac_addr, cs, irq, rst, &spi, -1, -1, -1, SPI2_HOST, spi_freq_mhz);
}
#endif
Additional context
The usage of this new library method would be:
void setup() {
Serial.begin(115200);
Network.onEvent(onEvent);
uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
SPI.begin(ETH_SPI_SCK, ETH_SPI_MISO, ETH_SPI_MOSI);
ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_CS, ETH_PHY_IRQ, ETH_PHY_RST, SPI, mac);
}
I have checked existing list of Feature requests and the Contribution Guide
- I confirm I have checked existing list of Feature requests and Contribution Guide.
Metadata
Metadata
Assignees
Type
Projects
Status
Done