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 #793 background imageLoading...
Page #793 background image
Chapter 2. API Reference
wl_unmount - unmounts the partition and deinitializes the wear levelling module
wl_erase_range - erases a range of addresses in flash
wl_write - writes data to a partition
wl_read - reads data from a partition
wl_size - returns the size of available memory in bytes
wl_sector_size - returns the size of one sector
As a rule, try to avoid using raw wear levelling functions and use filesystem-specific functions instead.
Memory Size
The memory size is calculated in the wear levelling module based on partition parameters. The module uses some
sectors of flash for internal data.
See also
FAT Filesystem
Partition Table documentation
Application Example
An example which combines the wear levelling driver with the FATFS library is provided in the storage/wear_levelling
directory. This example initializes the wear levelling driver, mounts FATFS partition, as well as writes and reads data
from it using POSIX and C library APIs. See the storage/wear_levelling/README.md file for more information.
High level API Reference
Header Files
fatfs/vfs/esp_vfs_fat.h
Functions
esp_err_t esp_vfs_fat_spiflash_mount(const char *base_path, const char *partition_label,
const esp_vfs_fat_mount_config_t *mount_config,
wl_handle_t *wl_handle)
Convenience function to initialize FAT filesystem in SPI flash and register it in VFS.
This is an all-in-one function which does the following:
finds the partition with defined partition_label. Partition label should be configured in the partition table.
initializes flash wear levelling library on top of the given partition
mounts FAT partition using FATFS library on top of flash wear levelling library
registers FATFS library with VFS, with prefix given by base_prefix variable
This function is intended to make example code more compact.
Return
ESP_OK on success
ESP_ERR_NOT_FOUND if the partition table does not contain FATFS partition with given label
ESP_ERR_INVALID_STATE if esp_vfs_fat_spiflash_mount was already called
ESP_ERR_NO_MEM if memory can not be allocated
ESP_FAIL if partition can not be mounted
other error codes from wear levelling library, SPI flash driver, or FATFS drivers
Parameters
base_path: path where FATFS partition should be mounted (e.g. /spiflash)
partition_label: label of the partition which should be used
mount_config: pointer to structure with extra parameters for mounting FATFS
[out] wl_handle: wear levelling driver handle
Espressif Systems 782
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