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-C3)

§Overview

The efuse module provides functionality for reading eFuse data from the ESP32-C3 chip, allowing access to various chip-specific information such as:

  • MAC address
  • ADC calibration data

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_ATTEN1
[] ADC1 calibration voltage at atten1
ADC1_CAL_VOL_ATTEN2
[] ADC1 calibration voltage at atten2
ADC1_CAL_VOL_ATTEN3
[] ADC1 calibration voltage at atten3
ADC1_INIT_CODE_ATTEN0
[] ADC1 init code at atten0
ADC1_INIT_CODE_ATTEN1
[] ADC1 init code at atten1
ADC1_INIT_CODE_ATTEN2
[] ADC1 init code at atten2
ADC1_INIT_CODE_ATTEN3
[] ADC1 init code at atten3
BLK_VERSION_MAJOR
[] BLK_VERSION_MAJOR of BLOCK2 {0: “No calibration”; 1: “With calibration”}
BLK_VERSION_MINOR
[] BLK_VERSION_MINOR
DIG_DBIAS_HVT
[] BLOCK1 digital dbias when hvt
DISABLE_BLK_VERSION_MAJOR
[] Disables check of blk version major
DISABLE_WAFER_VERSION_MAJOR
[] Disables check of wafer version major
DIS_DIRECT_BOOT
[DIS_LEGACY_SPI_BOOT] Disable direct boot mode
DIS_DOWNLOAD_ICACHE
[] Set this bit to disable Icache in download mode (boot_mode[3:0] is 0; 1; 2; 3; 6; 7)
DIS_DOWNLOAD_MANUAL_ENCRYPT
[] Set this bit to disable flash encryption when in download boot modes
DIS_DOWNLOAD_MODE
[] Set this bit to disable download mode (boot_mode[3:0] = 0; 1; 2; 3; 6; 7)
DIS_FORCE_DOWNLOAD
[] Set this bit to disable the function that forces chip into download mode
DIS_ICACHE
[] Set this bit to disable Icache
DIS_PAD_JTAG
[] Set this bit to disable JTAG in the hard way. JTAG is disabled permanently
DIS_TWAI
[DIS_CAN] Set this bit to disable TWAI function
DIS_USB_JTAG
[] Set this bit to disable function of usb switch to jtag in module of usb device
DIS_USB_SERIAL_JTAG
[DIS_USB_DEVICE] USB-Serial-JTAG {0: “Enable”; 1: “Disable”}
DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE
[DIS_USB_DOWNLOAD_MODE] Disable UART download mode through USB-Serial-JTAG
DIS_USB_SERIAL_JTAG_ROM_PRINT
[UART_PRINT_CHANNEL] USB printing {0: “Enable”; 1: “Disable”}
ENABLE_SECURITY_DOWNLOAD
[] Set this bit to enable secure UART download mode
ERR_RST_ENABLE
[] Use BLOCK0 to check error record registers {0: “without check”; 1: “with check”}
FLASH_CAP
[] Flash capacity {0: “None”; 1: “4M”; 2: “2M”; 3: “1M”; 4: “8M”}
FLASH_TEMP
[] Flash temperature {0: “None”; 1: “105C”; 2: “85C”}
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
FLASH_VENDOR
[] Flash vendor {0: “None”; 1: “XMC”; 2: “GD”; 3: “FM”; 4: “TT”; 5: “ZBIT”}
FORCE_SEND_RESUME
[] Set this bit to force ROM code to send a resume command during SPI boot
JTAG_SEL_ENABLE
[] Set this bit to enable selection between usb_to_jtag and pad_to_jtag through strapping gpio10 when both reg_dis_usb_jtag and reg_dis_pad_jtag are equal to 0
KEY0
[BLOCK_KEY0] Key0 or user data
KEY1
[BLOCK_KEY1] Key1 or user data
KEY2
[BLOCK_KEY2] Key2 or user data
KEY3
[BLOCK_KEY3] Key3 or user data
KEY4
[BLOCK_KEY4] Key4 or user data
KEY5
[BLOCK_KEY5] Key5 or user data
KEY_PURPOSE_0
[KEY0_PURPOSE] Purpose of Key0
KEY_PURPOSE_1
[KEY1_PURPOSE] Purpose of Key1
KEY_PURPOSE_2
[KEY2_PURPOSE] Purpose of Key2
KEY_PURPOSE_3
[KEY3_PURPOSE] Purpose of Key3
KEY_PURPOSE_4
[KEY4_PURPOSE] Purpose of Key4
KEY_PURPOSE_5
[KEY5_PURPOSE] Purpose of Key5
K_DIG_LDO
[] BLOCK1 K_DIG_LDO
K_RTC_LDO
[] BLOCK1 K_RTC_LDO
MAC
[MAC_FACTORY] MAC address
OCODE
[] ADC OCode
OPTIONAL_UNIQUE_ID
[] Optional unique 128-bit ID
PKG_VERSION
[] Package version
RD_DIS
[] Disable reading from BlOCK4-10
RD_DIS_BLOCK_KEY0
[RD_DIS.KEY0] rd_dis of BLOCK_KEY0
RD_DIS_BLOCK_KEY1
[RD_DIS.KEY1] rd_dis of BLOCK_KEY1
RD_DIS_BLOCK_KEY2
[RD_DIS.KEY2] rd_dis of BLOCK_KEY2
RD_DIS_BLOCK_KEY3
[RD_DIS.KEY3] rd_dis of BLOCK_KEY3
RD_DIS_BLOCK_KEY4
[RD_DIS.KEY4] rd_dis of BLOCK_KEY4
RD_DIS_BLOCK_KEY5
[RD_DIS.KEY5] rd_dis of BLOCK_KEY5
RD_DIS_BLOCK_SYS_DATA2
[RD_DIS.SYS_DATA_PART2] rd_dis of BLOCK_SYS_DATA2
SECURE_BOOT_AGGRESSIVE_REVOKE
[] Set this bit to enable revoking aggressive secure boot
SECURE_BOOT_EN
[] Set this bit to enable secure boot
SECURE_BOOT_KEY_REVOKE0
[] Revoke 1st secure boot key
SECURE_BOOT_KEY_REVOKE1
[] Revoke 2nd secure boot key
SECURE_BOOT_KEY_REVOKE2
[] Revoke 3rd secure boot key
SECURE_VERSION
[] Secure version (used by ESP-IDF anti-rollback feature)
SOFT_DIS_JTAG
[] Set these bits to disable JTAG in the soft way (odd number 1 means disable ). JTAG can be enabled in HMAC module
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”}
SPI_PAD_CONFIG_CLK
[] SPI PAD CLK
SPI_PAD_CONFIG_CS
[] SPI PAD CS
SPI_PAD_CONFIG_D
[] SPI PAD D(D0)
SPI_PAD_CONFIG_D4
[] SPI PAD D4
SPI_PAD_CONFIG_D5
[] SPI PAD D5
SPI_PAD_CONFIG_D6
[] SPI PAD D6
SPI_PAD_CONFIG_D7
[] SPI PAD D7
SPI_PAD_CONFIG_DQS
[] SPI PAD DQS
SPI_PAD_CONFIG_HD
[] SPI PAD HD(D3)
SPI_PAD_CONFIG_Q
[] SPI PAD Q(D1)
SPI_PAD_CONFIG_WP
[] SPI PAD WP(D2)
SYS_DATA_PART2
[BLOCK_SYS_DATA2] System data part 2 (reserved)
TEMP_CALIB
[] Temperature calibration data
THRES_HVT
[] BLOCK1 pvt threshold when hvt
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”}
USB_EXCHG_PINS
[] Set this bit to exchange USB D+ and D- pins
USER_DATA
[BLOCK_USR_DATA] User data
USER_DATA_MAC_CUSTOM
[MAC_CUSTOM CUSTOM_MAC] Custom MAC address
VDD_SPI_AS_GPIO
[] Set this bit to vdd spi pin function as gpio
V_DIG_DBIAS20
[] BLOCK1 voltage of digital dbias20
V_RTC_DBIAS20
[] BLOCK1 voltage of rtc dbias20
WAFER_VERSION_MAJOR
[] WAFER_VERSION_MAJOR
WAFER_VERSION_MINOR_HI
[] WAFER_VERSION_MINOR most significant bit
WAFER_VERSION_MINOR_LO
[] WAFER_VERSION_MINOR least significant bits
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_ATTEN1
[] wr_dis of ADC1_CAL_VOL_ATTEN1
WR_DIS_ADC1_CAL_VOL_ATTEN2
[] wr_dis of ADC1_CAL_VOL_ATTEN2
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_ATTEN1
[] wr_dis of ADC1_INIT_CODE_ATTEN1
WR_DIS_ADC1_INIT_CODE_ATTEN2
[] wr_dis of ADC1_INIT_CODE_ATTEN2
WR_DIS_ADC1_INIT_CODE_ATTEN3
[] wr_dis of ADC1_INIT_CODE_ATTEN3
WR_DIS_BLK1
[] wr_dis of BLOCK1
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_BLOCK_KEY1
[WR_DIS.KEY1] wr_dis of BLOCK_KEY1
WR_DIS_BLOCK_KEY2
[WR_DIS.KEY2] wr_dis of BLOCK_KEY2
WR_DIS_BLOCK_KEY3
[WR_DIS.KEY3] wr_dis of BLOCK_KEY3
WR_DIS_BLOCK_KEY4
[WR_DIS.KEY4] wr_dis of BLOCK_KEY4
WR_DIS_BLOCK_KEY5
[WR_DIS.KEY5] wr_dis of BLOCK_KEY5
WR_DIS_BLOCK_SYS_DATA2
[WR_DIS.SYS_DATA_PART2] wr_dis of BLOCK_SYS_DATA2
WR_DIS_BLOCK_USR_DATA
[WR_DIS.USER_DATA] wr_dis of BLOCK_USR_DATA
WR_DIS_CUSTOM_MAC
[WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM] wr_dis of CUSTOM_MAC
WR_DIS_DIG_DBIAS_HVT
[] wr_dis of DIG_DBIAS_HVT
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.DIS_LEGACY_SPI_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_FORCE_DOWNLOAD
[] wr_dis of DIS_FORCE_DOWNLOAD
WR_DIS_DIS_ICACHE
[] wr_dis of DIS_ICACHE
WR_DIS_DIS_PAD_JTAG
[] wr_dis of DIS_PAD_JTAG
WR_DIS_DIS_TWAI
[WR_DIS.DIS_CAN] wr_dis of DIS_TWAI
WR_DIS_DIS_USB_JTAG
[] wr_dis of DIS_USB_JTAG
WR_DIS_DIS_USB_SERIAL_JTAG
[WR_DIS.DIS_USB_DEVICE] wr_dis of DIS_USB_SERIAL_JTAG
WR_DIS_DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE
[WR_DIS.DIS_USB_DOWNLOAD_MODE] wr_dis of DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE
WR_DIS_DIS_USB_SERIAL_JTAG_ROM_PRINT
[WR_DIS.UART_PRINT_CHANNEL] wr_dis of DIS_USB_SERIAL_JTAG_ROM_PRINT
WR_DIS_ENABLE_SECURITY_DOWNLOAD
[] wr_dis of ENABLE_SECURITY_DOWNLOAD
WR_DIS_ERR_RST_ENABLE
[] wr_dis of ERR_RST_ENABLE
WR_DIS_FLASH_CAP
[] wr_dis of FLASH_CAP
WR_DIS_FLASH_TEMP
[] wr_dis of FLASH_TEMP
WR_DIS_FLASH_TPUW
[] wr_dis of FLASH_TPUW
WR_DIS_FLASH_VENDOR
[] wr_dis of FLASH_VENDOR
WR_DIS_FORCE_SEND_RESUME
[] wr_dis of FORCE_SEND_RESUME
WR_DIS_JTAG_SEL_ENABLE
[] wr_dis of JTAG_SEL_ENABLE
WR_DIS_KEY_PURPOSE_0
[WR_DIS.KEY0_PURPOSE] wr_dis of KEY_PURPOSE_0
WR_DIS_KEY_PURPOSE_1
[WR_DIS.KEY1_PURPOSE] wr_dis of KEY_PURPOSE_1
WR_DIS_KEY_PURPOSE_2
[WR_DIS.KEY2_PURPOSE] wr_dis of KEY_PURPOSE_2
WR_DIS_KEY_PURPOSE_3
[WR_DIS.KEY3_PURPOSE] wr_dis of KEY_PURPOSE_3
WR_DIS_KEY_PURPOSE_4
[WR_DIS.KEY4_PURPOSE] wr_dis of KEY_PURPOSE_4
WR_DIS_KEY_PURPOSE_5
[WR_DIS.KEY5_PURPOSE] wr_dis of KEY_PURPOSE_5
WR_DIS_K_DIG_LDO
[] wr_dis of K_DIG_LDO
WR_DIS_K_RTC_LDO
[] wr_dis of K_RTC_LDO
WR_DIS_MAC
[WR_DIS.MAC_FACTORY] wr_dis of MAC
WR_DIS_OCODE
[] wr_dis of OCODE
WR_DIS_OPTIONAL_UNIQUE_ID
[] wr_dis of OPTIONAL_UNIQUE_ID
WR_DIS_PKG_VERSION
[] wr_dis of PKG_VERSION
WR_DIS_RD_DIS
[] wr_dis of RD_DIS
WR_DIS_SECURE_BOOT_AGGRESSIVE_REVOKE
[] wr_dis of SECURE_BOOT_AGGRESSIVE_REVOKE
WR_DIS_SECURE_BOOT_EN
[] wr_dis of SECURE_BOOT_EN
WR_DIS_SECURE_BOOT_KEY_REVOKE0
[] wr_dis of SECURE_BOOT_KEY_REVOKE0
WR_DIS_SECURE_BOOT_KEY_REVOKE1
[] wr_dis of SECURE_BOOT_KEY_REVOKE1
WR_DIS_SECURE_BOOT_KEY_REVOKE2
[] wr_dis of SECURE_BOOT_KEY_REVOKE2
WR_DIS_SECURE_VERSION
[] wr_dis of SECURE_VERSION
WR_DIS_SOFT_DIS_JTAG
[] wr_dis of SOFT_DIS_JTAG
WR_DIS_SPI_BOOT_CRYPT_CNT
[] wr_dis of SPI_BOOT_CRYPT_CNT
WR_DIS_SPI_PAD_CONFIG_CLK
[] wr_dis of SPI_PAD_CONFIG_CLK
WR_DIS_SPI_PAD_CONFIG_CS
[] wr_dis of SPI_PAD_CONFIG_CS
WR_DIS_SPI_PAD_CONFIG_D
[] wr_dis of SPI_PAD_CONFIG_D
WR_DIS_SPI_PAD_CONFIG_D4
[] wr_dis of SPI_PAD_CONFIG_D4
WR_DIS_SPI_PAD_CONFIG_D5
[] wr_dis of SPI_PAD_CONFIG_D5
WR_DIS_SPI_PAD_CONFIG_D6
[] wr_dis of SPI_PAD_CONFIG_D6
WR_DIS_SPI_PAD_CONFIG_D7
[] wr_dis of SPI_PAD_CONFIG_D7
WR_DIS_SPI_PAD_CONFIG_DQS
[] wr_dis of SPI_PAD_CONFIG_DQS
WR_DIS_SPI_PAD_CONFIG_HD
[] wr_dis of SPI_PAD_CONFIG_HD
WR_DIS_SPI_PAD_CONFIG_Q
[] wr_dis of SPI_PAD_CONFIG_Q
WR_DIS_SPI_PAD_CONFIG_WP
[] wr_dis of SPI_PAD_CONFIG_WP
WR_DIS_SYS_DATA_PART1
[] wr_dis of BLOCK2
WR_DIS_TEMP_CALIB
[] wr_dis of TEMP_CALIB
WR_DIS_THRES_HVT
[] wr_dis of THRES_HVT
WR_DIS_UART_PRINT_CONTROL
[] wr_dis of UART_PRINT_CONTROL
WR_DIS_USB_EXCHG_PINS
[] wr_dis of USB_EXCHG_PINS
WR_DIS_VDD_SPI_AS_GPIO
[] wr_dis of VDD_SPI_AS_GPIO
WR_DIS_V_DIG_DBIAS20
[] wr_dis of V_DIG_DBIAS20
WR_DIS_V_RTC_DBIAS20
[] wr_dis of V_RTC_DBIAS20
WR_DIS_WAFER_VERSION_MAJOR
[] wr_dis of WAFER_VERSION_MAJOR
WR_DIS_WAFER_VERSION_MINOR_HI
[] wr_dis of WAFER_VERSION_MINOR_HI
WR_DIS_WAFER_VERSION_MINOR_LO
[] wr_dis of WAFER_VERSION_MINOR_LO
WR_DIS_WDT_DELAY_SEL
[] wr_dis of WDT_DELAY_SEL