Espressif ESP32-S2 Programming Manual page 761

Table of Contents

Advertisement

Chapter 2. API Reference
• chip: Pointer to identify flash chip. Must have been successfully initialised via esp_flash_init()
• address: Address on flash to write to. Must be previously erased (SPI NOR flash can only write
bits 1->0).
• buffer: Pointer to a buffer with the data to write. To get better performance, this should be in the
DRAM and word aligned.
• length: Length (in bytes) of data to write.
Return
• ESP_OK on success,
• ESP_ERR_NOT_SUPPORTED if the chip is not able to perform the operation. This is indicated
by WREN = 1 after the command is sent.
• Other flash error code if operation failed.
esp_err_t esp_flash_write_encrypted(esp_flash_t
Encrypted and write data to the SPI flash chip using on-chip hardware flash encryption.
Note Both address & length must be 16 byte aligned, as this is the encryption block size
Return
• ESP_OK: on success
• ESP_ERR_NOT_SUPPORTED: encrypted write not supported for this chip.
• ESP_ERR_INVALID_ARG: Either the address, buffer or length is invalid.
• or other flash error code from spi_flash_write_encrypted().
Parameters
• chip: Pointer to identify flash chip. Must be NULL (the main flash chip). For other chips, en-
crypted write is not supported.
• address: Address on flash to write to. 16 byte aligned. Must be previously erased (SPI NOR flash
can only write bits 1->0).
• buffer: Pointer to a buffer with the data to write.
• length: Length (in bytes) of data to write. 16 byte aligned.
esp_err_t esp_flash_read_encrypted(esp_flash_t
Read and decrypt data from the SPI flash chip using on-chip hardware flash encryption.
Return
• ESP_OK: on success
• ESP_ERR_NOT_SUPPORTED: encrypted read not supported for this chip.
• or other flash error code from spi_flash_read_encrypted().
Parameters
• chip: Pointer to identify flash chip. Must be NULL (the main flash chip). For other chips, en-
crypted read is not supported.
• address: Address on flash to read from.
• out_buffer: Pointer to a buffer for the data to read to.
• length: Length (in bytes) of data to read.
static bool esp_flash_is_quad_mode(const
Returns true if chip is configured for Quad I/O or Quad Fast Read.
Return true if flash works in quad mode, otherwise false
Parameters
• chip: Pointer to SPI flash chip to use. If NULL, esp_flash_default_chip is substituted.
Structures
struct esp_flash_region_t
Structure for describing a region of flash.
Public Members
uint32_t offset
Start address of this region.
Espressif Systems
*chip, uint32_t address, const void *buffer,
uint32_t length)
*chip, uint32_t address, void *out_buffer,
uint32_t length)
esp_flash_t
750
Submit Document Feedback
*chip)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF