Module efuse

Source
Expand description

§Reading of eFuses (ESP32-H2)

§Overview

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

  • MAC address
  • core count
  • CPU frequency
  • chip type

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.

§Example

§Read chip’s MAC address from the eFuse storage.

let mac_address = Efuse::get_mac_address();
writeln!(
    serial_tx,
    "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]
);

Structs§

Efuse
EfuseField
The bit field for get access to efuse data

Constants§

BLK_VERSION_MAJOR
[] BLK_VERSION_MAJOR of BLOCK2
BLK_VERSION_MINOR
[] BLK_VERSION_MINOR of BLOCK2. 1: RF Calibration data in BLOCK1
CRYPT_DPA_ENABLE
[] Represents whether anti-dpa attack is enabled. 1:enabled. 0: disabled
DISABLE_BLK_VERSION_MAJOR
[] Disables check of blk version major
DISABLE_WAFER_VERSION_MAJOR
[] Disables check of wafer version major
DIS_DIRECT_BOOT
[] Represents whether direct boot mode is disabled or enabled. 1: disabled. 0: enabled
DIS_DOWNLOAD_MANUAL_ENCRYPT
[] Represents whether flash encrypt function is disabled or enabled(except in SPI boot mode). 1: disabled. 0: enabled
DIS_DOWNLOAD_MODE
[] Represents whether Download mode is disabled or enabled. 1: disabled. 0: enabled
DIS_FORCE_DOWNLOAD
[] Represents whether the function that forces chip into download mode is disabled or enabled. 1: disabled. 0: enabled
DIS_ICACHE
[] Represents whether icache is disabled or enabled. 1: disabled. 0: enabled
DIS_PAD_JTAG
[] Represents whether JTAG is disabled in the hard way(permanently). 1: disabled. 0: enabled
DIS_TWAI
[DIS_CAN] Represents whether TWAI function is disabled or enabled. 1: disabled. 0: enabled
DIS_USB_JTAG
[] Represents whether the function of usb switch to jtag is disabled or enabled. 1: disabled. 0: enabled
DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE
[] Represents whether the USB-Serial-JTAG download function is disabled or enabled. 1: disabled. 0: enabled
DIS_USB_SERIAL_JTAG_ROM_PRINT
[DIS_USB_PRINT] Set this bit to disable USB-Serial-JTAG print during rom boot
ECDSA_FORCE_USE_HARDWARE_K
[] Represents whether hardware random number k is forced used in ESDCA. 1: force used. 0: not force used
ENABLE_SECURITY_DOWNLOAD
[] Represents whether security download is enabled or disabled. 1: enabled. 0: disabled
FLASH_CAP
[]
FLASH_TEMP
[]
FLASH_TPUW
[] Represents the flash waiting time after power-up; in unit of ms. When the value less than 15; the waiting time is the programmed value. Otherwise; the waiting time is 2 times the programmed value
FLASH_VENDOR
[]
FORCE_SEND_RESUME
[] Represents whether ROM code is forced to send a resume command during SPI boot. 1: forced. 0:not forced
HYS_EN_PAD0
[] Set bits to enable hysteresis function of PAD0~5
HYS_EN_PAD1
[] Set bits to enable hysteresis function of PAD6~27
JTAG_SEL_ENABLE
[] Set this bit to enable selection between usb_to_jtag and pad_to_jtag through strapping gpio25 when both EFUSE_DIS_PAD_JTAG and EFUSE_DIS_USB_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] Represents the purpose of Key0
KEY_PURPOSE_1
[KEY1_PURPOSE] Represents the purpose of Key1
KEY_PURPOSE_2
[KEY2_PURPOSE] Represents the purpose of Key2
KEY_PURPOSE_3
[KEY3_PURPOSE] Represents the purpose of Key3
KEY_PURPOSE_4
[KEY4_PURPOSE] Represents the purpose of Key4
KEY_PURPOSE_5
[KEY5_PURPOSE] Represents the purpose of Key5
MAC_EXT
[] Stores the extended bits of MAC address
MAC_FACTORY
[MAC_FACTORY] MAC address
OPTIONAL_UNIQUE_ID
[] Optional unique 128-bit ID
PKG_VERSION
[] Package version
POWERGLITCH_EN
[] Represents whether power glitch function is enabled. 1: enabled. 0: disabled
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
RXIQ_0
[] RF Calibration data. RXIQ data 0
RXIQ_1
[] RF Calibration data. RXIQ data 1
RXIQ_VERSION
[] RF Calibration data. RXIQ version
SECURE_BOOT_AGGRESSIVE_REVOKE
[] Represents whether revoking aggressive secure boot is enabled or disabled. 1: enabled. 0: disabled
SECURE_BOOT_DISABLE_FAST_WAKE
[] Represents whether FAST VERIFY ON WAKE is disabled or enabled when Secure Boot is enabled. 1: disabled. 0: enabled
SECURE_BOOT_EN
[] Represents whether secure boot is enabled or disabled. 1: enabled. 0: disabled
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
[] Represents the version used by ESP-IDF anti-rollback feature
SEC_DPA_LEVEL
[] Represents the spa secure level by configuring the clock random divide mode
SOFT_DIS_JTAG
[] Represents whether JTAG is disabled in soft way. Odd number: disabled. Even number: enabled
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_DOWNLOAD_MSPI_DIS
[] Represents whether SPI0 controller during boot_mode_download is disabled or enabled. 1: disabled. 0: enabled
SYS_DATA_PART2
[BLOCK_SYS_DATA2] System data part 2 (reserved)
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
[] Represents whether the D+ and D- pins is exchanged. 1: exchanged. 0: not exchanged
USER_DATA
[BLOCK_USR_DATA] User data
USER_DATA_MAC_CUSTOM
[MAC_CUSTOM CUSTOM_MAC] Custom MAC
VDD_SPI_AS_GPIO
[] Represents whether vdd spi pin is functioned as gpio. 1: functioned. 0: not functioned
WAFER_VERSION_MAJOR
[]
WAFER_VERSION_MINOR
[]
WDT_DELAY_SEL
[] Represents whether RTC watchdog timeout threshold is selected at startup. 1: selected. 0: not selected
WR_DIS
[] Disable programming of individual eFuses
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_CRYPT_DPA_ENABLE
[] wr_dis of CRYPT_DPA_ENABLE
WR_DIS_CUSTOM_MAC
[WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM] wr_dis of CUSTOM_MAC
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_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_DOWNLOAD_MODE
[] wr_dis of DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE
WR_DIS_DIS_USB_SERIAL_JTAG_ROM_PRINT
[WR_DIS.DIS_USB_PRINT] wr_dis of DIS_USB_SERIAL_JTAG_ROM_PRINT
WR_DIS_ECDSA_FORCE_USE_HARDWARE_K
[] wr_dis of ECDSA_FORCE_USE_HARDWARE_K
WR_DIS_ENABLE_SECURITY_DOWNLOAD
[] wr_dis of ENABLE_SECURITY_DOWNLOAD
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_HYS_EN_PAD0
[] wr_dis of HYS_EN_PAD0
WR_DIS_HYS_EN_PAD1
[] wr_dis of HYS_EN_PAD1
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_MAC
[WR_DIS.MAC_FACTORY] wr_dis of MAC
WR_DIS_MAC_EXT
[] wr_dis of MAC_EXT
WR_DIS_OPTIONAL_UNIQUE_ID
[] wr_dis of OPTIONAL_UNIQUE_ID
WR_DIS_PKG_VERSION
[] wr_dis of PKG_VERSION
WR_DIS_POWERGLITCH_EN
[] wr_dis of POWERGLITCH_EN
WR_DIS_RD_DIS
[] wr_dis of RD_DIS
WR_DIS_RXIQ_0
[] wr_dis of RXIQ_0
WR_DIS_RXIQ_1
[] wr_dis of RXIQ_1
WR_DIS_RXIQ_VERSION
[] wr_dis of RXIQ_VERSION
WR_DIS_SECURE_BOOT_AGGRESSIVE_REVOKE
[] wr_dis of SECURE_BOOT_AGGRESSIVE_REVOKE
WR_DIS_SECURE_BOOT_DISABLE_FAST_WAKE
[] wr_dis of SECURE_BOOT_DISABLE_FAST_WAKE
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_SEC_DPA_LEVEL
[] wr_dis of SEC_DPA_LEVEL
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_DOWNLOAD_MSPI_DIS
[] wr_dis of SPI_DOWNLOAD_MSPI_DIS
WR_DIS_SYS_DATA_PART1
[] wr_dis of BLOCK2
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_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