Available on crate feature
unstable
only.Expand description
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
§Reading of eFuses (ESP32)
§Overview
The efuse
module provides functionality for reading eFuse data
from the ESP32
chip, allowing access to various chip-specific information
such as:
- MAC address
- Chip type, revision
- Core count
- Max CPU frequency
and more. It is useful for retrieving chip-specific configuration and identification data during runtime.
The Efuse
struct represents the eFuse peripheral and is responsible for
reading various eFuse fields and values.
§Examples
§Read data from the eFuse storage.
let mac_address = Efuse::read_base_mac_address();
println!(
"MAC: {:#X}:{:#X}:{:#X}:{:#X}:{:#X}:{:#X}",
mac_address[0],
mac_address[1],
mac_address[2],
mac_address[3],
mac_address[4],
mac_address[5]
);
println!("MAC address {:02x?}", Efuse::mac_address());
println!("Flash Encryption {:?}", Efuse::flash_encryption());
println!("Core Count {}", Efuse::core_count());
println!("Bluetooth enabled {}", Efuse::is_bluetooth_enabled());
println!("Chip type {:?}", Efuse::chip_type());
println!("Max CPU clock {:?}", Efuse::max_cpu_frequency());
Structs§
- Efuse
- A struct representing the eFuse functionality of the chip.
Enums§
- Chip
Type - Representing different types of ESP32 chips.
Constants§
- ABS_
DONE_ 0 - Secure boot V1 is enabled for bootloader image
- ABS_
DONE_ 1 - Secure boot V2 is enabled for bootloader image
- ADC1_
TP_ HIGH - ADC1 Two Point calibration high point. Only valid if EFUSE_RD_BLK3_PART_RESERVE
- ADC1_
TP_ LOW - ADC1 Two Point calibration low point. Only valid if EFUSE_RD_BLK3_PART_RESERVE
- ADC2_
TP_ HIGH - ADC2 Two Point calibration high point. Only valid if EFUSE_RD_BLK3_PART_RESERVE
- ADC2_
TP_ LOW - ADC2 Two Point calibration low point. Only valid if EFUSE_RD_BLK3_PART_RESERVE
- ADC_
VREF - True ADC reference voltage
- BLK3_
PART_ RESERVE - BLOCK3 partially served for ADC calibration data
- BLK3_
RESERVED_ 2 - read for BLOCK3
- BLK3_
RESERVED_ 6 - read for BLOCK3
- BLK3_
RESERVED_ 7 - read for BLOCK3
- BLOCK1
- Flash encryption key
- BLOCK2
- Security boot key
- CHIP_
CPU_ FREQ_ LOW - If set alongside EFUSE_RD_CHIP_CPU_FREQ_RATED; the ESP32’s max CPU frequency is rated for 160MHz. 240MHz otherwise
- CHIP_
CPU_ FREQ_ RATED - If set; the ESP32’s maximum CPU frequency has been rated
- CHIP_
PACKAGE - Chip package identifier
- CHIP_
PACKAGE_ 4BIT - Chip package identifier #4bit
- CHIP_
VER_ REV1 - bit is set to 1 for rev1 silicon
- CHIP_
VER_ REV2 - CLK8M_
FREQ - 8MHz clock freq override
- CODING_
SCHEME - Efuse variable block length scheme
- CONSOLE_
DEBUG_ DISABLE - Disable ROM BASIC interpreter fallback
- CUSTOM_
MAC - Custom MAC address
- CUSTOM_
MAC_ CRC - CRC8 for custom MAC address
- DISABLE_
APP_ CPU - Disables APP CPU
- DISABLE_
BT - Disables Bluetooth
- DISABLE_
DL_ CACHE - Disable flash cache in UART bootloader
- DISABLE_
DL_ DECRYPT - Disable flash decryption in UART bootloader
- DISABLE_
DL_ ENCRYPT - Disable flash encryption in UART bootloader
- DISABLE_
SDIO_ HOST - DIS_
CACHE - Disables cache
- FLASH_
CRYPT_ CNT - Flash encryption is enabled if this field has an odd number of bits set
- FLASH_
CRYPT_ CONFIG - Flash encryption config (key tweak bits)
- JTAG_
DISABLE - Disable JTAG
- KEY_
STATUS - Usage of efuse block 3 (reserved)
- MAC0
- MAC address
- MAC1
- MAC address
- MAC_CRC
- CRC8 for MAC address
- MAC_
VERSION - Version of the MAC field
- RD_DIS
- Disable reading from BlOCK1-3
- RESERVED_
0_ 28 - reserved
- RESERVED_
3_ 56 - reserved
- RESERVED_
3_ 160 - reserved
- RESERVE_
0_ 88 - Reserved; it was created by set_missed_fields_in_regs func
- RESERVE_
0_ 112 - Reserved; it was created by set_missed_fields_in_regs func
- RESERVE_
0_ 141 - Reserved; it was created by set_missed_fields_in_regs func
- RESERVE_
0_ 145 - Reserved; it was created by set_missed_fields_in_regs func
- RESERVE_
0_ 181 - Reserved; it was created by set_missed_fields_in_regs func
- RESERVE_
0_ 186 - Reserved; it was created by set_missed_fields_in_regs func
- RESERVE_
0_ 203 - Reserved; it was created by set_missed_fields_in_regs func
- SECURE_
VERSION - Secure version for anti-rollback
- SPI_
PAD_ CONFIG_ CLK - Override SD_CLK pad (GPIO6/SPICLK)
- SPI_
PAD_ CONFIG_ CS0 - Override SD_CMD pad (GPIO11/SPICS0)
- SPI_
PAD_ CONFIG_ D - Override SD_DATA_1 pad (GPIO8/SPID)
- SPI_
PAD_ CONFIG_ HD - read for SPI_pad_config_hd
- SPI_
PAD_ CONFIG_ Q - Override SD_DATA_0 pad (GPIO7/SPIQ)
- UART_
DOWNLOAD_ DIS - Disable UART download mode. Valid for ESP32 V3 and newer; only
- VOL_
LEVEL_ HP_ INV - This field stores the voltage level for CPU to run at 240 MHz; or for flash/PSRAM to run at 80 MHz.0x0: level 7; 0x1: level 6; 0x2: level 5; 0x3: level 4. (RO)
- WAFER_
VERSION_ MINOR - WR_DIS
- Efuse write disable mask
- XPD_
SDIO_ FORCE - Ignore MTDI pin (GPIO12) for VDD_SDIO on reset
- XPD_
SDIO_ REG - read for XPD_SDIO_REG
- XPD_
SDIO_ TIEH - If XPD_SDIO_FORCE & XPD_SDIO_REG