This is the documentation for the latest (main) development branch. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

SDIO Host

Introduction

The SDIO Host module includes SDH SDMMC and SDH SPI.

  • SDIO Host: An interface used for embedded systems and computers that allows devices to communicate with various types of Secure Digital (SD) cards through the Secure Digital Input Output (SDIO) interface.

  • SDH SDMMC: Primarily used for reading and writing SD cards, including traditional SD cards and Secure Digital High Capacity (SDHC) cards.

  • SDH SPI: The SPI mode of the SDIO interface allows devices to communicate with SPI (Serial Peripheral Interface) devices through the SPI protocol. This is mainly used to drive devices that require only one-way communication, such as Thin Film Transistor (TFT) displays.

Function List

  • SDH SDMMC storage card read and write

  • SDH SPI synchronous data transfer

  • SDH SPI asynchronous data transfer

Function Overview

SDH SDMMC storage card read and write:

  • Supports traditional SD cards and SDHC cards, achieving efficient read and write operations for these storage media.

  • Allows users to access and store large amounts of data, including text, images, audio, and video files.

  • Used in conjunction with file systems like FatFS.

SDH SPI synchronous data transfer:

  • Transfers data synchronously using the SPI mode of the SDIO interface.

  • Mainly used for transferring small amounts of data, such as CMD transfers for driving TFT screens.

SDH SPI asynchronous data transfer:

  • Transfers data asynchronously using the SPI mode of the SDIO interface.

  • Mainly used for transferring large amounts of data, such as bulk display data transfers for driving TFT screens.

Hardware Configuration

Configured by modifying the DT (Device Tree).

Main Functions

SDH SDMMC Device Data Read/Write

Prerequisites:

  • SDH SDMMC initialization

Relevant Sequence API:

  • Call wm_drv_sdh_sdmmc_init to initialize the SDH SDMMC module.

  • Call wm_drv_sdh_sdmmc_read_blocks to read data blocks from the SDH SDMMC device.

  • Call wm_drv_sdh_sdmmc_write_blocks to write data blocks to the SDH SDMMC device.

Result:

  • Success returns WM_ERR_SUCCESS, failure returns the corresponding error code.

SDH SPI Device Data Transmission/Reception

Prerequisites:

  • Configure the SPI module.

  • SDH SPI initialization

Relevant Sequence API:

  • Call wm_drv_sdh_sdspi_init to initialize the SDH SPI module.

  • Call wm_drv_sdh_sdspi_transceive_sync to synchronously transmit and receive data through the SDH SPI device.

  • Call wm_drv_sdh_sdspi_transceive_async to asynchronously transmit and receive data through the SDH SPI device.

Result:

  • Success returns WM_ERR_SUCCESS, failure returns the corresponding error code.

Notes

  • For SDH SDMMC storage card read/write, the length of each data block is 512 bytes.

  • For SDH SPI asynchronous data transfer, the input data must be 4-byte aligned.

Application Example

examples/peripheral

API Reference

API Reference