Skip to content

MAC from efuse broken in ESP32 Arduino 2.x.x #6458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
smuellener opened this issue Mar 21, 2022 · 1 comment · Fixed by #6459
Closed
1 task done

MAC from efuse broken in ESP32 Arduino 2.x.x #6458

smuellener opened this issue Mar 21, 2022 · 1 comment · Fixed by #6459

Comments

@smuellener
Copy link
Contributor

smuellener commented Mar 21, 2022

Board

ESP32 Dev Module

Device Description

ESP32-WROOM-32

Hardware Configuration

Version

latest master

IDE Name

Arduino IDE

Operating System

Windows 11

Flash frequency

40Mhz

PSRAM enabled

yes

Upload speed

115200

Description

With ESP32 Ardunio < 2.0.0 it was possible to use ESP IDF functionality to use the custom MAC address from the efuse (see https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/api-reference/system/system.html?highlight=esp_base_mac_addr_set#custom-base-mac).

With ESP32 Arduino 2.x.x this functionality is broken because in ETH.begin() the interface is both reset and set up again. It will still look like the MAC address is custom but the low-level MAC address of the network interface is not custom but the internal one. This can be verified e.g. by using ARP scan (e.g. in Windows cmd: "arp -a").

The functionality could be reintroduced and the problem fixed by providing an additional argument to ETH.begin() where the user can select to read in the MAC Address from efuse. The custom MAC address can then be read in between the reset and setting up the interface.

Sketch

//The following code does NOT work anymore after updating to ESP32 Arduino 2.x.x

#include <ETH.h>
#include <WiFi.h>

void setup()
{
    Serial.begin(115200);

    uint8_t p[6] = { 0x00,0x00,0x00,0x00,0x00,0x00 };
    esp_efuse_mac_get_custom(p);
    esp_base_mac_addr_set(p);

    ETH.begin(); // in ESP32 Arduino 2.x.x this is undoing the step above
}

void loop()
{
}

Debug Message

-

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@VojtechBartoska
Copy link
Contributor

Hello @smuellener, thanks for reporting issue, providing a fix and also linking other related issues. We will review your PR as soon as possible.

@VojtechBartoska VojtechBartoska added Status: Pending and removed Status: Awaiting triage Issue is waiting for triage labels Mar 24, 2022
me-no-dev added a commit that referenced this issue Mar 29, 2022
Also support ESP_IDF_VERSION_MAJOR > 3
Fixes #6458

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants