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 #743 background imageLoading...
Page #743 background image
Chapter 2. API Reference
Sending commands to slave devices
Sending and receiving data
Handling error conditions within the bus
For functions used to initialize and configure:
SD SPI host, see SD SPI Host API
Application Example
An example which combines the SDMMC driver with the FATFS library is provided in the storage/sd_card directory
of ESP-IDF examples. This example initializes the card, then writes and reads data from it using POSIX and C library
APIs. See README.md file in the example directory for more information.
Combo (memory + IO) cards The driver does not support SD combo cards. Combo cards are treated as IO cards.
Thread safety Most applications need to use the protocol layer only in one task. For this reason, the protocol layer
does not implement any kind of locking on the sdmmc_card_t structure, or when accessing SDMMC or SD SPI
host drivers. Such locking is usually implemented on a higher layer, e.g., in the filesystem driver.
API Reference
Header File
components/sdmmc/include/sdmmc_cmd.h
Functions
esp_err_t sdmmc_card_init(const sdmmc_host_t *host, sdmmc_card_t *out_card)
Probe and initialize SD/MMC card using given host
Note Only SD cards (SDSC and SDHC/SDXC) are supported now. Support for MMC/eMMC cards will be
added later.
Return
ESP_OK on success
One of the error codes from SDMMC host controller
Parameters
host: pointer to structure defining host controller
out_card: pointer to structure which will receive information about the card when the function
completes
void sdmmc_card_print_info(FILE *stream, const sdmmc_card_t *card)
Print information about the card to a stream.
Parameters
stream: stream obtained using fopen or fdopen
card: card information structure initialized using sdmmc_card_init
esp_err_t sdmmc_get_status(sdmmc_card_t *card)
Get status of SD/MMC card
Return
ESP_OK on success
One of the error codes from SDMMC host controller
Parameters
card: pointer to card information structure previously initialized using sdmmc_card_init
esp_err_t sdmmc_write_sectors(sdmmc_card_t *card, const void *src, size_t start_sector, size_t sec-
tor_count)
Write given number of sectors to SD/MMC card
Espressif Systems 732
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