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

GeorgeFlorian1
Posts: 160
Joined: Thu Jan 31, 2019 2:32 pm

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

Postby GeorgeFlorian1 » Wed Nov 24, 2021 3:23 pm

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

GeorgeFlorian1
Posts: 160
Joined: Thu Jan 31, 2019 2:32 pm

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

Postby GeorgeFlorian1 » Sun Dec 05, 2021 11:28 am

Sooo ? Should it work or not ?

grescaldani
Posts: 7
Joined: Tue Mar 02, 2021 3:16 pm

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

Postby grescaldani » Thu Dec 09, 2021 8:27 pm

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!

GeorgeFlorian1
Posts: 160
Joined: Thu Jan 31, 2019 2:32 pm

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

Postby GeorgeFlorian1 » Sun Dec 12, 2021 11:08 am

I don't get it.

Who is online

Users browsing this forum: KMTsvetanov and 42 guests