Page 1 of 1
Set MAC Address
Posted: Fri Jun 16, 2017 9:35 pm
by embedded_systems
My application requires me to set the mac address and then report that address when I connect to a websocket. I found
this from read the docs. Right now I use esp_wifi_get_mac() to get the mac address of the wifi module, and that's what I'm reporting to the server. I now need to set that mac address myself. How do I store a custom mac address in BLK3 of EFUSE? Can I do it from the command line?
I found this
article talking about burning it, but it says it can be dangerous. Is this the right approach? Should I just store it in NVS and use that or is it better to burn it to eprom?
Re: Set MAC Address
Posted: Sat Jun 17, 2017 3:01 am
by ESP_igrr
You may store MAC address in NVS and set it via a call to esp_base_mac_addr_set function. Please take a look at system/base_mac_addr example which shows different MAC address storage options.
Re: Set MAC Address
Posted: Tue Oct 10, 2017 9:00 am
by teckhaokoh
Hi,
I've tried to set the mac address using esp_base_mac_addr_set().
It seems to be success to write, but my wifi STA keep showing:
D (2809) event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:EasyIO_RnD@wifi, ssid_len:15
, bssid:10:c3:7b:e1:c7:e8, reason:2
And the AP seems to be down as well, because I don't see the AP ssid in the wifi list.
When I remove the code that writing my custom mac address, it works normal again.
Re: Set MAC Address
Posted: Tue Oct 10, 2017 9:58 am
by WiFive
call esp_base_mac_addr_set to set the base MAC address before network interfaces are initialised.
Re: Set MAC Address
Posted: Wed Oct 11, 2017 2:15 am
by teckhaokoh
I'm setting the mac address in the app_main(), and it's the first code to run before I do any other initialization.
I started my code as below:
void app_main()
{
printf("set mac : 01:02:03:04:05:06\n");
uint8_t new_mac[8] = {0x01,0x02,0x03,0x04,0x05,0x06};
esp_base_mac_addr_set(new_mac);
...
}
Re: Set MAC Address
Posted: Wed Feb 08, 2023 11:58 am
by Bilalmalikuet
I know this is old but post it if maybe helpful for someone:
https://esp32tutorials.com/esp32-esp-id ... c-address/
Re: Set MAC Address
Posted: Sat Aug 10, 2024 3:50 pm
by Squirrelbd
Find and Change the MAC Address of ESP32 by following this guide which works for me.