Module efuse

Source
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_ATTEN0
ADC1 calibration voltage at atten0
ADC1_CAL_VOL_ATTEN3
ADC1 calibration voltage at atten3
ADC1_INIT_CODE_ATTEN0
ADC1 init code at atten0
ADC1_INIT_CODE_ATTEN3
ADC1 init code at atten3
ADC_CALIBRATION_3
Store the bit [86:96] of ADC calibration data
BLK2_RESERVED_DATA_0
Store the bit [0:20] of block2 reserved data
BLK2_RESERVED_DATA_1
Store the bit [21:52] of block2 reserved data
BLK_VERSION_MAJOR
Major version of BLOCK2
BLK_VERSION_MINOR
Minor version of BLOCK2
BLOCK_KEY0
BLOCK_KEY0 - 256-bits. 256-bit key of Flash Encryption
CUSTOM_MAC
Custom MAC address
CUSTOM_MAC_USED
True if MAC_CUSTOM is burned
DIG_DBIAS_HVT
BLOCK2 digital dbias when hvt
DIG_LDO_ACT_DBIAS26
BLOCK2 DIG_LDO_ACT_DBIAS26
DIG_LDO_ACT_STEPD10
BLOCK2 DIG_LDO_ACT_STEPD10
DIG_LDO_SLP_DBIAS2
BLOCK2 DIG_LDO_DBG0_DBIAS2
DIG_LDO_SLP_DBIAS26
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
MAC0
MAC address
MAC1
MAC address
OCODE
OCode
PKG_VERSION
EFUSE_PKG_VERSION
RD_DIS
Disable reading from BlOCK3
RESERVED_0_8
RESERVED_0_61
reserved
RESERVED_1_48
reserved
RESERVED_2_171
reserved
RTC_LDO_ACT_DBIAS13
BLOCK2 DIG_LDO_ACT_DBIAS13
RTC_LDO_ACT_DBIAS31
BLOCK2 DIG_LDO_ACT_DBIAS31
RTC_LDO_SLP_DBIAS13
BLOCK2 DIG_LDO_SLP_DBIAS13
RTC_LDO_SLP_DBIAS29
BLOCK2 DIG_LDO_SLP_DBIAS29
RTC_LDO_SLP_DBIAS31
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
SYSTEM_DATA2
Stores the bits [64:87] of system data
TEMP_CALIB
Temperature calibration data
UART_PRINT_CONTROL
Set the default UARTboot message output mode
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
WR_DIS
Disable programming of individual eFuses
XTS_KEY_LENGTH_256
Flash encryption key length