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
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_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
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_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 {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_ATTEN0
[] wr_dis of ADC1_CAL_VOL_ATTEN0
WR_DIS_ADC1_CAL_VOL_ATTEN3
[] wr_dis of ADC1_CAL_VOL_ATTEN3
WR_DIS_ADC1_INIT_CODE_ATTEN0
[] wr_dis of ADC1_INIT_CODE_ATTEN0
WR_DIS_ADC1_INIT_CODE_ATTEN3
[] 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_DBIAS26
[] wr_dis of DIG_LDO_ACT_DBIAS26
WR_DIS_DIG_LDO_ACT_STEPD10
[] wr_dis of DIG_LDO_ACT_STEPD10
WR_DIS_DIG_LDO_SLP_DBIAS2
[] wr_dis of DIG_LDO_SLP_DBIAS2
WR_DIS_DIG_LDO_SLP_DBIAS26
[] 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_DBIAS13
[] wr_dis of RTC_LDO_ACT_DBIAS13
WR_DIS_RTC_LDO_ACT_DBIAS31
[] wr_dis of RTC_LDO_ACT_DBIAS31
WR_DIS_RTC_LDO_SLP_DBIAS13
[] wr_dis of RTC_LDO_SLP_DBIAS13
WR_DIS_RTC_LDO_SLP_DBIAS29
[] wr_dis of RTC_LDO_SLP_DBIAS29
WR_DIS_RTC_LDO_SLP_DBIAS31
[] 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”}