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-C2)
§Overview
The efuse
module provides functionality for reading eFuse data
from the ESP32-C2
chip, allowing access to various chip-specific
information such as:
- MAC address
- ADC calibration information
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());
Structs§
- Efuse
- A struct representing the eFuse functionality of the chip.
Constants§
- ADC1_
CAL_ VOL_ ATTE N0 []
ADC1 calibration voltage at atten0- ADC1_
CAL_ VOL_ ATTE N3 []
ADC1 calibration voltage at atten3- ADC1_
INIT_ CODE_ ATTE N0 []
ADC1 init code at atten0- ADC1_
INIT_ CODE_ ATTE N3 []
ADC1 init code at atten3- ADC_
CALIBRATION_ 3 []
Store the bit[86:96]
of ADC calibration data- BLK_
VERSION_ MAJOR []
Major version of BLOCK2- BLK_
VERSION_ MINOR []
Minor version of BLOCK2 {0: “No calib”; 1: “With calib”}- CUSTOM_
MAC_ USED [ENABLE_CUSTOM_MAC]
True if MAC_CUSTOM is burned- DIG_
DBIAS_ HVT []
BLOCK2 digital dbias when hvt- DIG_
LDO_ ACT_ DBIA S26 []
BLOCK2 DIG_LDO_ACT_DBIAS26- DIG_
LDO_ ACT_ STEP D10 []
BLOCK2 DIG_LDO_ACT_STEPD10- DIG_
LDO_ SLP_ DBIA S2 []
BLOCK2 DIG_LDO_DBG0_DBIAS2- DIG_
LDO_ SLP_ DBIA S26 []
BLOCK2 DIG_LDO_DBG0_DBIAS26- DISABLE_
BLK_ VERSION_ MAJOR []
Disables check of blk version major- DISABLE_
WAFER_ VERSION_ MAJOR []
Disables check of wafer version major- DIS_
DIRECT_ BOOT []
This bit set means disable direct_boot mode- DIS_
DOWNLOAD_ ICACHE []
The bit be set to disable icache in download mode- DIS_
DOWNLOAD_ MANUAL_ ENCRYPT []
The bit be set to disable manual encryption- DIS_
DOWNLOAD_ MODE []
Set this bit to disable download mode (boot_mode[3:0]
= 0; 1; 2; 4; 5; 6; 7)- DIS_
PAD_ JTAG []
Set this bit to disable pad jtag- ENABLE_
SECURITY_ DOWNLOAD []
Set this bit to enable secure UART download mode- FLASH_
TPUW []
Configures flash waiting time after power-up; in unit of ms. If the value is less than 15; the waiting time is the configurable value. Otherwise; the waiting time is twice the configurable value- FORCE_
SEND_ RESUME []
Set this bit to force ROM code to send a resume command during SPI boot- KEY0
[BLOCK_KEY0]
BLOCK_BLOCK_KEY0 - 256-bits. 256-bit key of Flash Encryption- KEY0_
FE_ 128BIT []
128bit FE key- KEY0_
FE_ 256BIT []
256bit FE key- KEY0_
SB_ 128BIT []
128bit SB key- MAC
[MAC_FACTORY]
MAC address- OCODE
[]
OCode- PKG_
VERSION []
EFUSE_PKG_VERSION- RD_DIS
[]
Disable reading from BlOCK3- RD_
DIS_ KEY0 []
Read protection for EFUSE_BLK3. KEY0- RD_
DIS_ KEY0_ HI []
Read protection for EFUSE_BLK3. KEY0 higher 128-bit key- RD_
DIS_ KEY0_ LOW []
Read protection for EFUSE_BLK3. KEY0 lower 128-bit key- RTC_
LDO_ ACT_ DBIA S13 []
BLOCK2 DIG_LDO_ACT_DBIAS13- RTC_
LDO_ ACT_ DBIA S31 []
BLOCK2 DIG_LDO_ACT_DBIAS31- RTC_
LDO_ SLP_ DBIA S13 []
BLOCK2 DIG_LDO_SLP_DBIAS13- RTC_
LDO_ SLP_ DBIA S29 []
BLOCK2 DIG_LDO_SLP_DBIAS29- RTC_
LDO_ SLP_ DBIA S31 []
BLOCK2 DIG_LDO_SLP_DBIAS31- SECURE_
BOOT_ EN []
The bit be set to enable secure boot- SECURE_
VERSION []
Secure version for anti-rollback- SPI_
BOOT_ CRYPT_ CNT []
Enables flash encryption when 1 or 3 bits are set and disables otherwise {0: “Disable”; 1: “Enable”; 3: “Disable”; 7: “Enable”}- TEMP_
CALIB []
Temperature calibration data- UART_
PRINT_ CONTROL []
Set the default UARTboot message output mode {0: “Enable”; 1: “Enable when GPIO8 is low at reset”; 2: “Enable when GPIO8 is high at reset”; 3: “Disable”}- USER_
DATA []
User data block- USER_
DATA_ MAC_ CUSTOM [MAC_CUSTOM CUSTOM_MAC]
Custom MAC address- WAFER_
VERSION_ MAJOR []
WAFER_VERSION_MAJOR- WAFER_
VERSION_ MINOR []
WAFER_VERSION_MINOR- WDT_
DELAY_ SEL []
RTC watchdog timeout threshold; in unit of slow clock cycle {0: “40000”; 1: “80000”; 2: “160000”; 3: “320000”}- WR_DIS
[]
Disable programming of individual eFuses- WR_
DIS_ ADC1_ CAL_ VOL_ ATTE N0 []
wr_dis of ADC1_CAL_VOL_ATTEN0- WR_
DIS_ ADC1_ CAL_ VOL_ ATTE N3 []
wr_dis of ADC1_CAL_VOL_ATTEN3- WR_
DIS_ ADC1_ INIT_ CODE_ ATTE N0 []
wr_dis of ADC1_INIT_CODE_ATTEN0- WR_
DIS_ ADC1_ INIT_ CODE_ ATTE N3 []
wr_dis of ADC1_INIT_CODE_ATTEN3- WR_
DIS_ ADC_ CALIBRATION_ 3 []
wr_dis of ADC_CALIBRATION_3- WR_
DIS_ BLK_ VERSION_ MAJOR []
wr_dis of BLK_VERSION_MAJOR- WR_
DIS_ BLK_ VERSION_ MINOR []
wr_dis of BLK_VERSION_MINOR- WR_
DIS_ BLOCK_ KEY0 [WR_DIS.KEY0]
wr_dis of BLOCK_KEY0- WR_
DIS_ CUSTOM_ MAC [WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM]
wr_dis of CUSTOM_MAC- WR_
DIS_ CUSTOM_ MAC_ USED [WR_DIS.ENABLE_CUSTOM_MAC]
wr_dis of CUSTOM_MAC_USED- WR_
DIS_ DIG_ DBIAS_ HVT []
wr_dis of DIG_DBIAS_HVT- WR_
DIS_ DIG_ LDO_ ACT_ DBIA S26 []
wr_dis of DIG_LDO_ACT_DBIAS26- WR_
DIS_ DIG_ LDO_ ACT_ STEP D10 []
wr_dis of DIG_LDO_ACT_STEPD10- WR_
DIS_ DIG_ LDO_ SLP_ DBIA S2 []
wr_dis of DIG_LDO_SLP_DBIAS2- WR_
DIS_ DIG_ LDO_ SLP_ DBIA S26 []
wr_dis of DIG_LDO_SLP_DBIAS26- WR_
DIS_ DISABLE_ BLK_ VERSION_ MAJOR []
wr_dis of DISABLE_BLK_VERSION_MAJOR- WR_
DIS_ DISABLE_ WAFER_ VERSION_ MAJOR []
wr_dis of DISABLE_WAFER_VERSION_MAJOR- WR_
DIS_ DIS_ DIRECT_ BOOT []
wr_dis of DIS_DIRECT_BOOT- WR_
DIS_ DIS_ DOWNLOAD_ ICACHE []
wr_dis of DIS_DOWNLOAD_ICACHE- WR_
DIS_ DIS_ DOWNLOAD_ MANUAL_ ENCRYPT []
wr_dis of DIS_DOWNLOAD_MANUAL_ENCRYPT- WR_
DIS_ DIS_ DOWNLOAD_ MODE []
wr_dis of DIS_DOWNLOAD_MODE- WR_
DIS_ DIS_ PAD_ JTAG []
wr_dis of DIS_PAD_JTAG- WR_
DIS_ ENABLE_ SECURITY_ DOWNLOAD []
wr_dis of ENABLE_SECURITY_DOWNLOAD- WR_
DIS_ FLASH_ TPUW []
wr_dis of FLASH_TPUW- WR_
DIS_ FORCE_ SEND_ RESUME []
wr_dis of FORCE_SEND_RESUME- WR_
DIS_ MAC [WR_DIS.MAC_FACTORY]
wr_dis of MAC- WR_
DIS_ OCODE []
wr_dis of OCODE- WR_
DIS_ PKG_ VERSION []
wr_dis of PKG_VERSION- WR_
DIS_ RD_ DIS []
wr_dis of RD_DIS- WR_
DIS_ RTC_ LDO_ ACT_ DBIA S13 []
wr_dis of RTC_LDO_ACT_DBIAS13- WR_
DIS_ RTC_ LDO_ ACT_ DBIA S31 []
wr_dis of RTC_LDO_ACT_DBIAS31- WR_
DIS_ RTC_ LDO_ SLP_ DBIA S13 []
wr_dis of RTC_LDO_SLP_DBIAS13- WR_
DIS_ RTC_ LDO_ SLP_ DBIA S29 []
wr_dis of RTC_LDO_SLP_DBIAS29- WR_
DIS_ RTC_ LDO_ SLP_ DBIA S31 []
wr_dis of RTC_LDO_SLP_DBIAS31- WR_
DIS_ SECURE_ BOOT_ EN []
wr_dis of SECURE_BOOT_EN- WR_
DIS_ SECURE_ VERSION []
wr_dis of SECURE_VERSION- WR_
DIS_ SPI_ BOOT_ CRYPT_ CNT []
wr_dis of SPI_BOOT_CRYPT_CNT- WR_
DIS_ TEMP_ CALIB []
wr_dis of TEMP_CALIB- WR_
DIS_ UART_ PRINT_ CONTROL []
wr_dis of UART_PRINT_CONTROL- WR_
DIS_ WAFER_ VERSION_ MAJOR []
wr_dis of WAFER_VERSION_MAJOR- WR_
DIS_ WAFER_ VERSION_ MINOR []
wr_dis of WAFER_VERSION_MINOR- WR_
DIS_ WDT_ DELAY_ SEL []
wr_dis of WDT_DELAY_SEL- WR_
DIS_ XTS_ KEY_ LENGTH_ 256 []
wr_dis of XTS_KEY_LENGTH_256- XTS_
KEY_ LENGTH_ 256 []
Flash encryption key length {0: “128 bits key”; 1: “256 bits key”}