Page 1 of 1

esp_eth_set_mac does nothing. Can't change ESP's MAC Address

Posted: Wed Nov 24, 2021 3:23 pm
by GeorgeFlorian1
Hello.

I'm trying to set the MAC of the ETH interface the same as the WiFi interface using the following code:

Code: Select all

    ETH.begin();

    uint8_t mac[] = {};
    esp_wifi_get_mac(WIFI_IF_STA, &mac[0]);
    esp_eth_set_mac(&mac[0]);
    Serial.print("ETH MAC: ");
    Serial.println(ETH.macAddress());
This prints the right MAC, which is the same as the WiFi's MAC (7c-9e-bd-30-2d-a8), but using arp -a in cmd or looking in the router's device list gives me the original ETH MAC: 7c-9e-bd-30-2d-ab

How do I properly change the ETH MAC Address ?

I have an ESP32-EVB with the following MACs:
WiFi Mac: 7c-9e-bd-30-2d-a8
ETH Mac: 7c-9e-bd-30-2d-ab

I am using PlatformioIDE with PlatformIO Core, version 5.2.3

Re: esp_eth_set_mac does nothing. Can't change ESP's MAC Address

Posted: Sun Dec 05, 2021 11:28 am
by GeorgeFlorian1
Sooo ? Should it work or not ?

Re: esp_eth_set_mac does nothing. Can't change ESP's MAC Address

Posted: Thu Dec 09, 2021 8:27 pm
by grescaldani
Why not:

uint8_t mac[6];
esp_wifi_get_mac(WIFI_IF_STA, mac);
esp_eth_set_mac(mac);

The MAC address is 6 bytes long!

Re: esp_eth_set_mac does nothing. Can't change ESP's MAC Address

Posted: Sun Dec 12, 2021 11:08 am
by GeorgeFlorian1
I don't get it.