How to Get LAN8720 MAC


If you are asking a question, please follow this template:

  1. My goal is: How to get LAN8720 MAC from ESP32
  2. My actions are: I need get the MAC into variable print it on log (LL_INFO)
  3. The result I see is: I can’t find a way to do this, only how to get WIFI MAC
  4. My expectation & question is: A way to get LAN8720 MAC Address from ESP32

According to the Ethernet support page:
“ESP32 includes an Ethernet MAC and requires an external PHY, connected over RMII interface”
Therefore, what you want is the ESP32 Ethernet MAC (the LAN8720 is “just” a PHY).
Your MAC should be displayed at startup (see here)
In this page there is an example for reading it through ESP-IDF. I would bet you can also read it from your Mongoose-OS configuration but I don’t have suitable hardware to test that assumption.
Though, as I posted some time ago, Espressif devices MAC addresses are assigned in groups of 4 and WiFi MACs, Bluetooth MAC and Ethernet MAC are closely related (explained here), so your Ethernet MAC will be your WiFi MAC with the least significant bits set (add 3 to the station address or add 2 to the Access Point address)


Thansk a lot for this information… I already saw the MAC at at startup time (see here ), but I would like to get it anytime at a variable… do you know any way to do this?


Worth taking a look at the mos.yml file for the library and seeing if it has the variables you might need

Assuming the eth.phy_addr is what you wanted you should be able to get it with: