EasyManuals Logo

Espressif ESP32-S2 User Manual

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
Page #758 background imageLoading...
Page #758 background image
Chapter 2. API Reference
int input_delay_ns
Input delay of the data pins, in ns. Set to 0 if unknown.
int cs_id
CS line ID, ignored when not host_id is not SPI1_HOST, or CON-
FIG_SPI_FLASH_SHARE_SPI1_BUS is enabled. In this case, the CS line used is automatically
assigned by the SPI bus lock.
Header File
components/spi_flash/include/esp_flash.h
Functions
esp_err_t esp_flash_init(esp_flash_t *chip)
Initialise SPI flash chip interface.
This function must be called before any other API functions are called for this chip.
Note Only the host and read_mode fields of the chip structure must be initialised before this function is
called. Other fields may be auto-detected if left set to zero or NULL.
Note If the chip->drv pointer is NULL, chip chip_drv will be auto-detected based on its manufacturer &
product IDs. See esp_flash_registered_flash_drivers pointer for details of this process.
Return ESP_OK on success, or a flash error code if initialisation fails.
Parameters
chip: Pointer to SPI flash chip to use. If NULL, esp_flash_default_chip is substituted.
bool esp_flash_chip_driver_initialized(const esp_flash_t *chip)
Check if appropriate chip driver is set.
Return true if set, otherwise false.
Parameters
chip: Pointer to SPI flash chip to use. If NULL, esp_flash_default_chip is substituted.
esp_err_t esp_flash_read_id(esp_flash_t *chip, uint32_t *out_id)
Read flash ID via the common RDIDSPI flash command.
ID is a 24-bit value. Lower 16 bits of idare the chip ID, upper 8 bits are the manufacturer ID.
Parameters
chip: Pointer to identify flash chip. Must have been successfully initialised via esp_flash_init()
[out] out_id: Pointer to receive ID value.
Return ESP_OK on success, or a flash error code if operation failed.
esp_err_t esp_flash_get_size(esp_flash_t *chip, uint32_t *out_size)
Detect flash size based on flash ID.
Note Most flash chips use a common format for flash ID, where the lower 4 bits specify the size as a power of
2. If the manufacturer doesnt follow this convention, the size may be incorrectly detected.
Return ESP_OK on success, or a flash error code if operation failed.
Parameters
chip: Pointer to identify flash chip. Must have been successfully initialised via esp_flash_init()
[out] out_size: Detected size in bytes.
esp_err_t esp_flash_read_unique_chip_id(esp_flash_t *chip, uint64_t *out_id)
Read flash unique ID via the common RDUIDSPI flash command.
ID is a 64-bit value.
Parameters
chip: Pointer to identify flash chip. Must have been successfully initialised via esp_flash_init().
[out] out_id: Pointer to receive unique ID value.
Return
ESP_OK on success, or a flash error code if operation failed.
Espressif Systems 747
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish