efuse: Add CUSTOM_MAC address for ESP32-C3/-S2/-S3/-H2

This commit is contained in:
KonstantinKondrashov
2021-07-19 15:16:42 +05:00
parent a0c548ccd4
commit 40c360a096
19 changed files with 140 additions and 30 deletions

View File

@@ -50,6 +50,8 @@
OPTIONAL_UNIQUE_ID (BLOCK2)(0 errors): Optional unique 128-bit ID
= 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W
BLOCK2_VERSION (BLOCK2) Version of BLOCK2 = No calibration R/W (0b000)
CUSTOM_MAC (BLOCK3) Custom MAC Address
= 00:00:00:00:00:00 (OK) R/W
Jtag Config fuses:
JTAG_SEL_ENABLE (BLOCK0) Set this bit to enable selection between usb_to_jt = False R/W (0b0)

View File

@@ -66,6 +66,8 @@
OPTIONAL_UNIQUE_ID (BLOCK2)(0 errors): Optional unique 128-bit ID
= 7d 33 b8 bb 0b 13 b3 c8 71 37 0e e8 7c ab d5 92 R/W
BLOCK2_VERSION (BLOCK2) Version of BLOCK2 = With calibration R/W (0b001)
CUSTOM_MAC (BLOCK3) Custom MAC Address
= 00:00:00:00:00:00 (OK) R/W
Security fuses:
SOFT_DIS_JTAG (BLOCK0) Software disables JTAG. When software disabled, JT = False R/W (0b0)

View File

@@ -66,6 +66,8 @@
OPTIONAL_UNIQUE_ID (BLOCK2)(0 errors): Optional unique 128-bit ID
= 7d 33 b8 bb 0b 13 b3 c8 71 37 0e e8 7c ab d5 92 R/W
BLOCK2_VERSION (BLOCK2) Version of BLOCK2 = With calibration R/W (0b001)
CUSTOM_MAC (BLOCK3) Custom MAC Address
= 00:00:00:00:00:00 (OK) R/W
Security fuses:
SOFT_DIS_JTAG (BLOCK0) Software disables JTAG. When software disabled, JT = False R/W (0b000)

View File

@@ -102,14 +102,14 @@ The custom base MAC addresses should be allocated such that derived MAC addresse
It is also possible to call the function :cpp:func:`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.
.. This API is ESP32-only, see IDF-1326
Custom MAC address in eFuse
@@@@@@@@@@@@@@@@@@@@@@@@@@@
When reading custom MAC addresses from eFuse, ESP-IDF provides a helper function :cpp:func:`esp_efuse_mac_get_custom`. This loads the MAC address from eFuse BLK3. This function assumes that the custom base MAC address is stored in the following format:
.. only:: esp32
Custom MAC address in eFuse
@@@@@@@@@@@@@@@@@@@@@@@@@@@
When reading custom MAC addresses from eFuse, ESP-IDF provides a helper function :cpp:func:`esp_efuse_mac_get_custom`. This loads the MAC address from eFuse BLK3. This function assumes that the custom base MAC address is stored in the following format:
+-----------------+-----------+---------------+------------------------------+
| Field | # of bits | Range of bits | Notes |
+=================+===========+===============+==============================+
@@ -122,7 +122,25 @@ The custom base MAC addresses should be allocated such that derived MAC addresse
| MAC address CRC | 8 | 7:0 | CRC-8-CCITT, polynomial 0x07 |
+-----------------+-----------+---------------+------------------------------+
Once MAC address has been obtained using :cpp:func:`esp_efuse_mac_get_custom`, call :cpp:func:`esp_base_mac_addr_set` to set this MAC address as base MAC address.
.. note::
If the 3/4 coding scheme is enabled, all eFuse fields in this block must be burnt at the same time.
.. only:: not esp32
+-----------------+-----------+---------------+
| Field | # of bits | Range of bits |
+=================+===========+===============+
| MAC address | 48 | 200:248 |
+-----------------+-----------+---------------+
.. note::
The eFuse BLK3 uses RS-coding during a burn operation it means that all eFuse fields in this block must be burnt at the same time.
Once MAC address has been obtained using :cpp:func:`esp_efuse_mac_get_custom`, call :cpp:func:`esp_base_mac_addr_set` to set this MAC address as base MAC address.
.. _local-mac-addresses: