EasyManua.ls Logo

Espressif ESP32-S2 - Page 819

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
RS. EFUSE_BLK1 - EFUSE_BLK10 use Reed-Solomon coding scheme that supports up to 5 bytes of au-
tomatic error correction. Software will encode the 32-byte EFUSE_BLKx using RS (44, 32) to generate a
12-byte check code, and then burn the EFUSE_BLKx and the check code into eFuse at the same time. The
eFuse Controller automatically decodes the RS encoding and applies error correction when reading back the
eFuse block. Because the RS check codes are generated across the entire 256-bit eFuse block, each block can
only be written to one time.
To write some fields into one block, or different blocks in one time, you need to use the batch writ-
ing mode. Firstly set this mode through esp_efuse_batch_write_begin() function then write
some fields as usual using the esp_efuse_write_... functions. At the end to burn them, call the
esp_efuse_batch_write_commit() function. It burns prepared data to the eFuse blocks and disables the
batch recording mode.
eFuse API
Access to the fields is via a pointer to the description structure. API functions have some basic operation:
esp_efuse_read_field_blob() - returns an array of read eFuse bits.
esp_efuse_read_field_cnt() - returns the number of bits programmed as 1.
esp_efuse_write_field_blob() - writes an array.
esp_efuse_write_field_cnt() - writes a required count of bits as 1.
esp_efuse_get_field_size() - returns the number of bits by the field name.
esp_efuse_read_reg() - returns value of eFuse register.
esp_efuse_write_reg() - writes value to eFuse register.
esp_efuse_get_coding_scheme() - returns eFuse coding scheme for blocks.
esp_efuse_read_block() - reads key to eFuse block starting at the offset and the required size.
esp_efuse_write_block() - writes key to eFuse block starting at the offset and the required size.
esp_efuse_batch_write_begin() - set the batch mode of writing fields.
esp_efuse_batch_write_commit() - writes all prepared data for batch writing mode and reset the
batch writing mode.
esp_efuse_batch_write_cancel() - reset the batch writing mode and prepared data.
esp_efuse_get_key_dis_read() - Returns a read protection for the key block.
esp_efuse_set_key_dis_read() - Sets a read protection for the key block.
esp_efuse_get_key_dis_write() - Returns a write protection for the key block.
esp_efuse_set_key_dis_write() - Sets a write protection for the key block.
esp_efuse_get_key_purpose() - Returns the current purpose set for an eFuse key block.
esp_efuse_write_key() - Programs a block of key data to an eFuse block
esp_efuse_write_keys() - Programs keys to unused eFuse blocks
esp_efuse_find_purpose() - Finds a key block with the particular purpose set.
esp_efuse_get_keypurpose_dis_write() - Returns a write protection of the key purpose field
for an eFuse key block (for esp32 always true).
esp_efuse_key_block_unused() - Returns true if the key block is unused, false otherwise.
For frequently used elds, special functions are made, like this esp_efuse_get_chip_ver(),
esp_efuse_get_pkg_ver().
eFuse API for keys
EFUSE_BLK_KEY0 - EFUSE_BLK_KEY5 are intended to keep up to 6 keys with a length of 256-bits. Each
key has an ESP_EFUSE_KEY_PURPOSE_x field which defines the purpose of these keys. The purpose field is
described in esp_efuse_purpose_t.
The purposes like ESP_EFUSE_KEY_PURPOSE_XTS_AES_... are used for flash encryption.
The purposes like ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST... are used for secure boot.
There are some eFuse APIs useful to work with states of keys.
esp_efuse_get_purpose_field() - Returns a pointer to a key purpose for an eFuse key block.
esp_efuse_get_key() - Returns a pointer to a key block.
Espressif Systems 808
Submit Document Feedback
Release v4.4

Table of Contents