EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1023 background imageLoading...
Page #1023 background image
Chapter 2. API Reference
Heap memory
Two heap memory related functions are provided:
esp_get_free_heap_size() returns the current size of free heap memory
esp_get_minimum_free_heap_size() returns the minimum size of free heap memory that was
available during program execution.
Note that ESP-IDF supports multiple heaps with different capabilities. Functions mentioned in this section return the
size of heap memory which can be allocated using malloc family of functions. For further information about heap
memory see Heap Memory Allocation.
MAC Address
These APIs allow querying and customizing MAC addresses for different network interfaces that supported (e.g.
Wi-Fi, Bluetooth, Ethernet).
To fetch MAC address for a specific interface (e.g. Wi-Fi Station, Wi-Fi SoftAP), call the function
esp_read_mac() function.
In ESP-IDF these addresses are calculated from a single Base MAC address. By default, the Espressif base MAC
address is used. This MAC is pre-programmed into ESP32-S2 eFuse from the factory.
Interface MAC address (2 universally admin-
istered, default)
MAC address (1 universally administered)
Wi-Fi Sta-
tion
base_mac base_mac
Wi-Fi Sof-
tAP
base_mac, +1 to the last octet Local MAC (derived from Wi-Fi Station MAC)
Ethernet (see
note)
Local MAC (derived from Wi-Fi Sof-
tAP MAC
Local MAC (derived from base_mac with +1 to last
octet. Not recommended.)
Note: The default configuration is 2 universally administered MAC addresses, and this is recommended when using
Espressif-provided MAC addresses.
Note: ESP32-S2 has no integrated Ethernet MAC, but its still possible to calculate an Ethernet MAC address.
This MAC address can only be used with an external interface such as a SPI-Ethernet device, see Ethernet.
Custom Base MAC The default Base MAC is pre-programmed by Espressif in eFuse BLK1. To set a custom
Base MAC instead, call the function esp_base_mac_addr_set() before initializing any network interfaces
or calling the esp_read_mac() function. The customized MAC address can be stored in any supported storage
device (e.g. Flash, NVS, etc).
The custom base MAC addresses should be allocated such that derived MAC addresses will not overlap. Configure
the option CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES to set the number of valid universal MAC addresses
that can be derived from the custom base MAC, according to the table above.
Note: It is also possible to call the function esp_netif_set_mac() to set the specific MAC used by a network
interface, after network initialization. It
s recommended to use the Base MAC approach documented here instead,
to avoid the possibility of the original MAC address briefly appearing on the network before it is changed.
Espressif Systems 1012
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish