Understanding SD, SDIO and MMC Interface

TL;DR; MMC and SD-card have the same physical and electrical specifications but different software controls. They both are used as storage devices only. SDIO and SD-Combo cards, on the other hand, incorporate Input/Output functionality (like Bluetooth, Wifi, GPS, etc) without and with the storage facility respectively. So, an SD-Combo card can act as a wifi adapter along with a storage device.

In this blog post, I will present a summary of the following document http://www.kaltech.co.il/pdf/Eureka_sd_wp1.pdf. This is meant for anyone willing to understand how removable devices like sd cards work and the different protocols/functionalities they support.

Secure Digital (SD) memory card is one of the most popular non-volatile removable data storage media for consumer applications. It’s not intended to remove hard-disk. Hard-disk can still deliver much better speed and memory capacity. SD card is used in applications demanding optimum memory capacity, smaller size, and low-end product cost.  The combination of a small footprint, lower cost, and optimal performance contributed to SD-card’s success.

What is a MultiMedia Card (MMC)?

MMC and Sd-card share many standard features and have the same physical and electrical specifications. The differences between the two standards are mainly on the software level commands. The similarities allow many hosts to accept both MMC and SD cards on the same socket.

Basic SD Protocol

SD card follows two protocols SD protocol and SPI protocol.

microSD Pinout, SD Mode
Pin # Pin Name Signal Function
1 DAT2 Data Bit 2
2 CD/DAT3 Card Detect / Data Bit 3
3 CMD Command Line
4 Vdd Supply Voltage 2.7v / 3.6v
5 CLK Clock
6 Vss Ground
7 DAT0 Data Bit 0
8 DAT1 Data Bit 1
microSD Pinout, SPI Mode
Pin # Pin Name Signal Function
1 NC No Connect
2 /CS Chip Select
3 DI Master Out/Slave In (MOSI)
4 Vdd Supply Voltage 2.7v / 3.6v
5 CLK Clock
6 Vss Ground
7 DO Master In/Slave Out (MISO)
8 RSV Reserved

So, let us first look at the SD protocol:

SD card pinout


In this, commands are transferred to and fro via a bidirectional CMD pin in the form of discrete packets of 48 bits. These command packets include command index, argument, and CRC bits. The command is always sent via the host and received via the sd card. Response packets are also of 48 bits. During data transfer, the basic unit of transmission is called a block, which is usually of 512 bytes and is transferred via all 4 data pins. Also, after each block transfer, 16 bit of CRC data is sent.

Note that the sd card operates in states. Each state has different sets of commands, and hosts can change state via controls. Command and data signals are synchronized via a clock signal. Initially, the host uses the 400KHz clock to communicate with the card, but it then eventually increase the clock speed during transfer for max. Efficiency. Reason: Before initialization, the host doesn’t know whether it’s an SD card or an MMC card. Now MMC card by default during initialization works in Open-drain mode(100-400KHz) while the SD card works in push-pull mode(0-25Mhz). Thus, initially, the host uses 400KHz to stay compatible with both open-drain and push-pull mode.

SD protocol versions

  • SD- version 1
  • SDHC- version 2 Higher data transfer speed + increased capacity
  • SDXC- version 3 even higher capacity


SD bus specification defines three card types: memory-only card, IO card (SDIO), and card combining memory and IO functions (SD combo). Few memory commands were removed while new I/O commands were added.
For example, the SDIO cards don’t have a programming state while SD cards have.
At a time SDIO card can perform a maximum of 8 different functions. Of which the first two types are user function and system function.

SD bus specification specifies:
  • the physical signal interface on SD bus
  • Definition of each command and its expected response
  • a set of standard registers on sd card
  • internal state and status of the card
  • the command sequence for initializing and enabling data transfer

Note that the SD bus specification doesn’t define the type of memory/IO to be used with an SD card or SDIO card. So apart from NAND, one can even use any other non-volatile memory with sd card. Similarly, there’s no restriction on the type of I/O function that can be performed by the SDIO card.

What makes an SD card Host controller?

SD card host controller is a hardware logic between the CPU and the SD bus. So the host controller has a 256-byte register set which is mapped to the system’s memory / IO space and by reading which CPU can perform the following functions:

  • Detect insertion/removal of SD card
  • turn on/off SD card power
  • control SD card clock speed
  • define-command arguments and send commands to sd card
  • receive command response from sd card
  • read/write data from/to sd card
  • interrupt the CPU on different events
  • suspend/resume/terminate data transaction

It can also include DMA support. The host is responsible for providing power(3V3) to sd card a

Long with the interrupt to CPU upon insertion of the SD card.

SD card Design

Sd card controller handles all physical and data link level functions like command decoding, CRC, response generation, etc. In most NAND designs, access to NAND needs to go through a local processor that handles wear and bad block management. SD controller doesn’t directly access the flash chip, it either accesses the shadow memory or interrupts the SD MPU to read/write data.

How does SPI come into the picture?

Earlier SD cards/MMC support SPI to communicate/interface with MCU with SPI ports. But recently, SPI support is decreased significantly.

How is card insertion/removal or write protection handled?

SD specification supports hot insertion/removal of the SD card. The most common way of detection is simply via two micro switches in the SD host controller to check for write protection or insertion/removal.

SD card file-system

By default, the SD card doesn’t have any file system. It works on RAW blocks of data. It’s the responsibility of OS to build a file system on top of RAW space. Follow on to my next post for more details regarding working with the raw file system.

Tagged , , ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.