Espressif ESP32-S2 Programming Manual page 743

Table of Contents

Advertisement

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
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
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
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
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
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
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
Write given number of sectors to SD/MMC card
Espressif Systems
The driver does not support SD combo cards. Combo cards are treated as IO cards.
sdmmc_card_t
sdmmc_host_t
*host,
*card)
*card, const void *src, size_t start_sector, size_t sec-
tor_count)
732
Submit Document Feedback
structure, or when accessing SDMMC or SD SPI
sdmmc_card_t
*out_card)
sdmmc_card_t
*card)
storage/sd_card
directory
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