I recently purchased a couple of ESP-S3-Zero to replace a pair of ESP32-C3-Zero that operate in a peer - peer mode. I was able to get the Mac Addresses from the ESP32-C3-Zero with any issues but when tried the ESP32-S3-Zero it was a no go, all I got was “16:26:20.526 → ESP-ROM:esp32s3-20210327” which appears to be the firmware version. I’ve done exhaustive internet search, can anyone give me some help. Thanks
There are more then one mac address, so some tweaking may be needed.
The base mac address is the one used by wifi (unless changed), then others are based on that.
src: Miscellaneous System APIs - ESP32 - — ESP-IDF Programming Guide v5.2.5 documentation
example
#include "esp_mac.h"
uint8_t MAC[6];
esp_read_mac(MAC, ESP_MAC_BASE);
printf ("MAC Addr: %02X:%02X:%02X:%02X:%02X:%02X\n",MAC[0],MAC[1],MAC[2],MAC[3],MAC[4],MAC[5]);
From above on my S3 I get
MAC Addr: 3C:84:27:CA:65:B4
which is the one on the wifi station connected to my AP
3c-84-27-ca-65-b4
Some notes
ESP_MAC_WIFI_STA MAC for WiFi Station (6 bytes)
ESP_MAC_WIFI_SOFTAP MAC for WiFi Soft-AP (6 bytes)
ESP_MAC_BT MAC for Bluetooth (6 bytes)
ESP_MAC_ETH MAC for Ethernet (6 bytes)
ESP_MAC_IEEE802154 if CONFIG_SOC_IEEE802154_SUPPORTED=y,
MAC for IEEE802154 (8 bytes)
ESP_MAC_BASE Base MAC for that used for other MAC types (6 bytes)
ESP_MAC_EFUSE_FACTORY MAC_FACTORY eFuse which was burned by Espressif in production (6 bytes)
ESP_MAC_EFUSE_CUSTOM MAC_CUSTOM eFuse which was can be burned by customer (6 bytes)
ESP_MAC_EFUSE_EXT if CONFIG_SOC_IEEE802154_SUPPORTED=y,
MAC_EXT eFuse which is used as an extender
for IEEE802154 MAC (2 bytes)
Wi-Fi Station base_mac
Wi-Fi SoftAP base_mac, +1 to the last octet
Bluetooth base_mac, +2 to the last octet
Ethernet base_mac, +3 to the last octet
Hi Michael,
Thanks for your reply,
I copied and pasted into IDE selected the correct board 'Waveshare
ESP32-S3-Zero but I run the compiler I get the following error,
C:\Users\alano\AppData\Local\Temp.arduinoIDE-unsaved2025223-2352-1vhj7fw.h0etl\sketch_mar23a\sketch_mar23a.ino:4:17:
error: expected constructor, destructor, or type conversion before ‘(’ token
4 | esp_read_mac(MAC, ESP_MAC_BASE);
> ^
C:\Users\alano\AppData\Local\Temp.arduinoIDE-unsaved2025223-2352-1vhj7fw.h0etl\sketch_mar23a\sketch_mar23a.ino:5:12:
error: expected constructor, destructor, or type conversion before ‘(’ token
5 | printf (“MAC Addr:
%02X:%02X:%02X:%02X:%02X:%02X\n”,MAC[0],MAC[1],MAC[2],MAC[3],MAC[4],MAC[5]);
> ^
exit status 1
Compilation error: expected constructor, destructor, or type conversion
before ‘(’ token
All the best
Alan
What is the code you are using? This works for the Arduino IDE:
#include "esp_mac.h"
void setup() {
Serial.begin(115200);
// Variable to store the MAC address
uint8_t MAC[6];
// Get Base MAC address
esp_read_mac(MAC, ESP_MAC_BASE);
printf ("MAC Addr: %02X:%02X:%02X:%02X:%02X:%02X\n",MAC[0],MAC[1],MAC[2],MAC[3],MAC[4],MAC[5]);
}
void loop() {}
Hi Jeff,
Thanks for reply,
I’m using Aduino IDE 2.3.4
You code compiles and I’ve run it using the “Waveshare ESP32-S3-Zero” and the generic “ESP32S3 Dev Module” but all that is displayed is the ROM detail.
Thanks Again
Alan
I can only test with a C3 rather than an S3, but I believe for the ‘mini’ they work the same. You need to set up a separate IDE session and connect it with a second USB to serial converter to the S3 UART TX pin, set the second instance of the IDE to that second virtual COM port, and read the console output using the console feature of that IDE.
Another option is to configure the MCU with a simple I2C text display module and display the MAC details to that device.
Thanks Jeff ,
I’ll consider the option and yes getting the Mac Address out of a C3 is snack but these C6s are another beast.
Thanks again keep well
Alan
Note that if it’s the STA or SOFTAP MAC that you are after you can load up the appropriate sample application and it will show up on your router as new wireless connection (for STA) or on your phone as a new hotspot (for SOFTAP).