Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7c9b837

Browse filesBrowse files
smuellenerSuGliderme-no-dev
authored
Fix Reading MAC from efuse for ESP32 Arduino 2.x.x (espressif#6458) (espressif#6459)
Also support ESP_IDF_VERSION_MAJOR > 3 Fixes espressif#6458 Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com> Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
1 parent 5c5a112 commit 7c9b837
Copy full SHA for 7c9b837

File tree

Expand file treeCollapse file tree

2 files changed

+17
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-2
lines changed

‎libraries/Ethernet/src/ETH.cpp

Copy file name to clipboardExpand all lines: libraries/Ethernet/src/ETH.cpp
+16-1Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,19 @@ ETHClass::ETHClass()
226226
ETHClass::~ETHClass()
227227
{}
228228

229-
bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_type_t type, eth_clock_mode_t clock_mode)
229+
bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_type_t type, eth_clock_mode_t clock_mode, bool use_mac_from_efuse)
230230
{
231231
#if ESP_IDF_VERSION_MAJOR > 3
232232
eth_clock_mode = clock_mode;
233233
tcpipInit();
234234

235+
if (use_mac_from_efuse)
236+
{
237+
uint8_t p[6] = { 0x00,0x00,0x00,0x00,0x00,0x00 };
238+
esp_efuse_mac_get_custom(p);
239+
esp_base_mac_addr_set(p);
240+
}
241+
235242
tcpip_adapter_set_default_eth_handlers();
236243

237244
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
@@ -363,6 +370,14 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
363370
}
364371

365372
tcpipInit();
373+
374+
if (use_mac_from_efuse)
375+
{
376+
uint8_t p[6] = { 0x00,0x00,0x00,0x00,0x00,0x00 };
377+
esp_efuse_mac_get_custom(p);
378+
esp_base_mac_addr_set(p);
379+
}
380+
366381
err = esp_eth_init(&eth_config);
367382
if(!err){
368383
initialized = true;

‎libraries/Ethernet/src/ETH.h

Copy file name to clipboardExpand all lines: libraries/Ethernet/src/ETH.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ETHClass {
7575
ETHClass();
7676
~ETHClass();
7777

78-
bool begin(uint8_t phy_addr=ETH_PHY_ADDR, int power=ETH_PHY_POWER, int mdc=ETH_PHY_MDC, int mdio=ETH_PHY_MDIO, eth_phy_type_t type=ETH_PHY_TYPE, eth_clock_mode_t clk_mode=ETH_CLK_MODE);
78+
bool begin(uint8_t phy_addr=ETH_PHY_ADDR, int power=ETH_PHY_POWER, int mdc=ETH_PHY_MDC, int mdio=ETH_PHY_MDIO, eth_phy_type_t type=ETH_PHY_TYPE, eth_clock_mode_t clk_mode=ETH_CLK_MODE, bool use_mac_from_efuse=false);
7979

8080
bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = (uint32_t)0x00000000, IPAddress dns2 = (uint32_t)0x00000000);
8181

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.