Skip to main content

Module efuse

Module efuse 

Source
Expand description

§eFuse (one-time programmable configuration)

§Overview

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

  • MAC address
  • Chip revision

and more. It is useful for retrieving chip-specific configuration and identification data during runtime.

§Examples

§Reading interface MAC addresses

use esp_hal::efuse::{self, InterfaceMacAddress};

let mac = efuse::interface_mac_address(InterfaceMacAddress::Station);
println!("MAC: {mac}");
println!("MAC bytes: {:02x?}", mac.as_bytes());

Structs§

ChipRevision
Represents the hardware revision.
EfuseFieldunstable
The bit field for get access to efuse data
MacAddress
Hardware (MAC) address.

Enums§

AdcCalibUnitunstable
Selects which ADC we are interested in the efuse calibration data for
InterfaceMacAddress
Interface selection for interface_mac_address.
SetMacErrorunstable
Error indicating issues with setting the MAC address.

Constants§

ACTIVE_HP_DBIASunstable
Active HP DBIAS of fixed voltage
ACTIVE_LP_DBIASunstable
Active LP DBIAS of fixed voltage
ADC1_AVE_INITCODE_ATTEN0unstable
Average initcode of ADC1 atten0
ADC1_AVE_INITCODE_ATTEN1unstable
Average initcode of ADC1 atten0
ADC1_AVE_INITCODE_ATTEN2unstable
Average initcode of ADC1 atten0
ADC1_AVE_INITCODE_ATTEN3unstable
Average initcode of ADC1 atten0
ADC1_CH0_ATTEN0_INITCODE_DIFFunstable
Gap between ADC1 CH0 and average initcode
ADC1_CH1_ATTEN0_INITCODE_DIFFunstable
Gap between ADC1 CH1 and average initcode
ADC1_CH2_ATTEN0_INITCODE_DIFFunstable
Gap between ADC1 CH2 and average initcode
ADC1_CH3_ATTEN0_INITCODE_DIFFunstable
Gap between ADC1 CH3 and average initcode
ADC1_CH4_ATTEN0_INITCODE_DIFFunstable
Gap between ADC1 CH4 and average initcode
ADC1_CH5_ATTEN0_INITCODE_DIFFunstable
Gap between ADC1 CH5 and average initcode
ADC1_HI_DOUT_ATTEN0unstable
HI DOUT of ADC1 atten0
ADC1_HI_DOUT_ATTEN1unstable
HI DOUT of ADC1 atten1
ADC1_HI_DOUT_ATTEN2unstable
HI DOUT of ADC1 atten2
ADC1_HI_DOUT_ATTEN3unstable
HI DOUT of ADC1 atten3
BLK_VERSION_MAJORunstable
BLK_VERSION_MAJOR of BLOCK2
BLK_VERSION_MINORunstable
BLK_VERSION_MINOR of BLOCK2
BLOCK_KEY0unstable
Key0 or user data
BLOCK_KEY1unstable
Key1 or user data
BLOCK_KEY2unstable
Key2 or user data
BLOCK_KEY3unstable
Key3 or user data
BLOCK_KEY4unstable
Key4 or user data
BLOCK_KEY5unstable
Key5 or user data
BLOCK_SYS_DATA2unstable
System data part 2 (reserved)
BLOCK_USR_DATAunstable
User data
BOOTLOADER_ANTI_ROLLBACK_ENunstable
Represents whether the ani-rollback check for the 2nd stage bootloader is enabled
BOOTLOADER_ANTI_ROLLBACK_SECURE_VERSION_HIunstable
Represents the anti-rollback secure version of the 2nd stage bootloader used by the ROM bootloader (the high part of the field)
BOOTLOADER_ANTI_ROLLBACK_SECURE_VERSION_LOunstable
Represents the anti-rollback secure version of the 2nd stage bootloader used by the ROM bootloader (the low part of the field)
BOOTLOADER_ANTI_ROLLBACK_UPDATE_IN_ROMunstable
Represents whether the ani-rollback SECURE_VERSION will be updated from the ROM bootloader
CUSTOM_MACunstable
Custom MAC
DISABLE_BLK_VERSION_MAJORunstable
Disables check of blk version major
DISABLE_WAFER_VERSION_MAJORunstable
Disables check of wafer version major
DIS_DIRECT_BOOTunstable
Represents whether direct boot mode is disabled or enabled
DIS_DOWNLOAD_MANUAL_ENCRYPTunstable
Represents whether flash encryption is disabled (except in SPI boot mode)
DIS_DOWNLOAD_MODEunstable
Represents whether Download mode is disable or enable
DIS_FORCE_DOWNLOADunstable
Represents whether the function that forces chip into Download mode is disabled
DIS_ICACHEunstable
Represents whether cache is disabled
DIS_PAD_JTAGunstable
Represents whether PAD JTAG is disabled in the hard way (permanently)
DIS_TWAIunstable
Represents whether TWAI function is disabled
DIS_USB_JTAGunstable
Represents whether the USB-to-JTAG function in USB Serial/JTAG is disabled. Note that EFUSE_DIS_USB_JTAG is available only when EFUSE_DIS_USB_SERIAL_JTAG is configured to 0
DIS_USB_SERIAL_JTAGunstable
Represents whether USB Serial/JTAG is disabled
DIS_USB_SERIAL_JTAG_DOWNLOAD_MODEunstable
Represents whether the USB-Serial-JTAG download function is disabled or enabled
DIS_USB_SERIAL_JTAG_ROM_PRINTunstable
Represents whether print from USB-Serial-JTAG is disabled or enabled
DSLP_LP_DBGunstable
DSLP LP DBG of fixed voltage
DSLP_LP_DBIASunstable
DSLP LP DBIAS of fixed voltage
ECC_FORCE_CONST_TIMEunstable
Represents whether to force ECC to use constant-time mode for point multiplication calculation
ENABLE_SECURITY_DOWNLOADunstable
Represents whether security download is enabled. Only downloading into flash is supported. Reading/writing RAM or registers is not supported (i.e. stub download is not supported)
FLASH_CAPunstable
Flash capacity
FLASH_TPUWunstable
Represents the flash waiting time after power-up. Measurement unit: ms. When the value is less than 15; the waiting time is the programmed value. Otherwise; the waiting time is a fixed value; i.e. 30 ms
FLASH_VENDORunstable
Flash vendor
FORCE_DISABLE_SW_INIT_KEYunstable
Represents whether to disable the use of the initialization key written by software and instead force use efuse_init_key
FORCE_SEND_RESUMEunstable
Represents whether ROM code is forced to send a resume command during SPI boot
FORCE_USE_KEY_MANAGER_KEYunstable
Represents whether the corresponding key must come from Key Manager. Bit0: ECDSA key (0: Not required, 1: Required). Bit1: XTS-AES (flash and PSRAM) key (0: Not required, 1: Required). Bit2: HMAC key (0: Not required, 1: Required). Bit3: DS key (0: Not required, 1: Required)
HUK_GEN_STATEunstable
Represents whether the HUK generate mode is valid. Odd count of bits with a value of 1: Invalid; Even count of bits with a value of 1: Valid
HYS_EN_PADunstable
Represents whether the hysteresis function of PAD0 - PAD27 is enabled
JTAG_SEL_ENABLEunstable
Represents whether the selection of a JTAG signal source through the strapping pin value is enabled when all of EFUSE_DIS_PAD_JTAG; EFUSE_DIS_USB_JTAG and EFUSE_DIS_USB_SERIAL_JTAG are configured to 0
KEY_PURPOSE_0unstable
Represents the purpose of Key0.
KEY_PURPOSE_1unstable
Represents the purpose of Key1.
KEY_PURPOSE_2unstable
Represents the purpose of Key2.
KEY_PURPOSE_3unstable
Represents the purpose of Key3.
KEY_PURPOSE_4unstable
Represents the purpose of Key4.
KEY_PURPOSE_5unstable
Represents the purpose of Key5.
KM_DEPLOY_ONLY_ONCEunstable
Represents whether the corresponding key can be deployed only once. Bit0: ECDSA key (0: Multiple times, 1: Only once). Bit1: XTS-AES (flash and PSRAM) key (0: Multiple times, 1: Only once). Bit2: HMAC key (0: Multiple times, 1: Only once). Bit3: DS key (0: Multiple times, 1: Only once)
KM_DISABLE_DEPLOY_MODEunstable
Represents whether the new key deployment of key manager is disabled. Bit0: ECDSA key deployment (0: Enabled, 1: Disabled). Bit1: XTS-AES (flash and PSRAM) key deployment (0: Enabled, 1: Disabled). Bit2: HMAC key deployment (0: Enabled, 1: Disabled). Bit3: DS key deployment (0: Enabled, 1: Disabled)
KM_RND_SWITCH_CYCLEunstable
Represents the cycle at which the Key Manager switches random numbers
KM_XTS_KEY_LENGTH_256unstable
Represents which key flash encryption uses
LOCK_KM_KEYunstable
Represents whether the keys in the Key Manager are locked after deployment
LP_HP_DBIAS_VOL_GAPunstable
DBIAS gap between LP and HP
LSLP_HP_DBGunstable
LSLP HP DBG of fixed voltage
LSLP_HP_DBIASunstable
LSLP HP DBIAS of fixed voltage
MAC0unstable
MAC address
MAC1unstable
MAC address
MAC_EXTunstable
Represents the extended bits of MAC address
OCODEunstable
ADC OCode
OPTIONAL_UNIQUE_IDunstable
Optional unique 128-bit ID
PA_TRIM_VERSIONunstable
PADC CAL PA trim version
PKG_VERSIONunstable
Package version
PSRAM_CAPunstable
Psram capacity
PSRAM_VENDORunstable
Psram vendor
RD_DISunstable
Disable reading from BlOCK4-10
RECOVERY_BOOTLOADER_FLASH_SECTOR_HIunstable
Represents the starting flash sector (flash sector size is 0x1000) of the recovery bootloader used by the ROM bootloader If the primary bootloader fails. 0 and 0xFFF - this feature is disabled. (The high part of the field)
RECOVERY_BOOTLOADER_FLASH_SECTOR_LOunstable
Represents the starting flash sector (flash sector size is 0x1000) of the recovery bootloader used by the ROM bootloader If the primary bootloader fails. 0 and 0xFFF - this feature is disabled. (The low part of the field)
REF_CURR_CODEunstable
REF PADC Calibration Curr
RESERVED_1_143unstable
reserved
RESERVED_2_249unstable
reserved
RESERVED_3_192unstable
reserved
RESERVED_3_248unstable
reserved
RESERVE_0_146unstable
Reserved; it was created by set_missed_fields_in_regs func
RESERVE_0_158unstable
Reserved; it was created by set_missed_fields_in_regs func
RESERVE_0_183unstable
Reserved; it was created by set_missed_fields_in_regs func
RES_TUNE_CODEunstable
RES PADC Calibration Tune
SECURE_BOOT_AGGRESSIVE_REVOKEunstable
Represents whether aggressive revocation of Secure Boot is enabled
SECURE_BOOT_DISABLE_FAST_WAKEunstable
Represents whether FAST VERIFY ON WAKE is disabled when Secure Boot is enabled
SECURE_BOOT_ENunstable
Represents whether Secure Boot is enabled
SECURE_BOOT_KEY_REVOKE0unstable
Revoke 1st secure boot key
SECURE_BOOT_KEY_REVOKE1unstable
Revoke 2nd secure boot key
SECURE_BOOT_KEY_REVOKE2unstable
Revoke 3rd secure boot key
SECURE_BOOT_SHA384_ENunstable
Represents if the chip supports Secure Boot using SHA-384
SECURE_VERSIONunstable
Represents the app secure version used by ESP-IDF anti-rollback feature
SEC_DPA_LEVELunstable
Represents the security level of anti-DPA attack. The level is adjusted by configuring the clock random frequency division mode
SOFT_DIS_JTAGunstable
Represents whether PAD JTAG is disabled in the soft way. It can be restarted via HMAC. Odd count of bits with a value of 1: Disabled; Even count of bits with a value of 1: Enabled
SPI_BOOT_CRYPT_CNTunstable
Enables flash encryption when 1 or 3 bits are set and disables otherwise
SPI_DOWNLOAD_MSPI_DISunstable
Represents whether SPI0 controller during boot_mode_download is disabled
SYS_DATA_PART0_2unstable
Represents the third 32-bit of zeroth part of system data
TEMPunstable
Temp (die embedded inside)
TEMPERATURE_SENSORunstable
Temperature calibration data
TRIM_N_BIASunstable
PADC CAL N bias
TRIM_P_BIASunstable
PADC CAL P bias
UART_PRINT_CONTROLunstable
Set the default UART boot message output mode
USB_DREFHunstable
Represents the single-end input threshold vrefh; 1.76 V to 2 V with step of 80 mV
USB_DREFLunstable
Represents the single-end input threshold vrefl; 1.76 V to 2 V with step of 80 mV
USB_EXCHG_PINSunstable
Represents whether the D+ and D- pins is exchanged
VDD_SPI_AS_GPIOunstable
Represents whether VDD SPI pin is functioned as GPIO
WAFER_VERSION_MAJORunstable
Minor chip version
WAFER_VERSION_MINORunstable
Minor chip version
WDT_DELAY_SELunstable
Represents RTC watchdog timeout threshold. The originally configured STG0 threshold * (2 ^ (EFUSE_WDT_DELAY_SEL + 1))
WR_DISunstable
Disable programming of individual eFuses
XTAL_48M_SELunstable
Represents whether XTAL frequency is 48MHz or not. If not; 40MHz XTAL will be used. If this field contains Odd number bit 1: Enable 48MHz XTAL; Even number bit 1: Enable 40MHz XTAL
XTAL_48M_SEL_MODEunstable
Represents what determines the XTAL frequency in Joint Download Boot mode
XTS_DPA_CLK_ENABLEunstable
Represents whether XTS-AES anti-DPA attack clock is enabled
XTS_DPA_PSEUDO_LEVELunstable
Represents the pseudo round level of XTS-AES anti-DPA attack

Functions§

base_mac_addressunstable
Returns the base MAC address programmed into eFuse during manufacturing.
block_versionunstable
Get efuse block version
chip_revision
Returns the hardware revision.
flash_encryptionunstable
Get status of SPI boot encryption.
interface_mac_address
Returns the MAC address for a specific interface, derived from the base MAC.
major_chip_versionunstable
Returns the major hardware revision
minor_chip_versionunstable
Returns the minor hardware revision
override_mac_addressunstable
Overrides the base MAC address used by interface_mac_address.
read_bitunstable
Read bit value.
read_field_leunstable
Read field value in a little-endian order
rtc_calib_cal_codeunstable
Get ADC calibration code
rtc_calib_cal_mvunstable
Get ADC calibration coefficients
rtc_calib_get_chan_compensunstable
Get the channel specific calibration compensation
rtc_calib_init_codeunstable
Get ADC initial code for specified attenuation from efuse
rtc_calib_versionunstable
Get version of RTC calibration block
rwdt_multiplierunstable
Get the multiplier for the timeout value of the RWDT STAGE 0 register.
xtal_frequency_mhzunstable
Returns the frequency of the crystal oscillator in MHz