Chapter 2. API Reference
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
• src: pointer to data buffer to read data from; data size must be equal to sector_count * card-
>csd.sector_size
• start_sector: sector where to start writing
• sector_count: number of sectors to write
esp_err_t sdmmc_read_sectors(sdmmc_card_t *card, void *dst, size_t start_sector, size_t sec-
tor_count)
Read given number of sectors from the 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
• dst: pointer to data buffer to write into; buffer size must be at least sector_count * card-
>csd.sector_size
• start_sector: sector where to start reading
• sector_count: number of sectors to read
esp_err_t sdmmc_io_read_byte(sdmmc_card_t *card, uint32_t function, uint32_t reg, uint8_t
*out_byte)
Read one byte from an SDIO card using IO_RW_DIRECT (CMD52)
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
• function: IO function number
• reg: byte address within IO function
• [out] out_byte: output, receives the value read from the card
esp_err_t sdmmc_io_write_byte(sdmmc_card_t *card, uint32_t function, uint32_t reg, uint8_t in_byte,
uint8_t *out_byte)
Write one byte to an SDIO card using IO_RW_DIRECT (CMD52)
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
• function: IO function number
• reg: byte address within IO function
• in_byte: value to be written
• [out] out_byte: if not NULL, receives new byte value read from the card (read-after-write).
esp_err_t sdmmc_io_read_bytes(sdmmc_card_t *card, uint32_t function, uint32_t addr, void *dst,
size_t size)
Read multiple bytes from an SDIO card using IO_RW_EXTENDED (CMD53)
This function performs read operation using CMD53 in byte mode. For block mode, see sd-
mmc_io_read_blocks.
Return
• ESP_OK on success
• ESP_ERR_INVALID_SIZE if size exceeds 512 bytes
• One of the error codes from SDMMC host controller
Parameters
Espressif Systems 733
Submit Document Feedback
Release v4.4