Transfer modes
The physical interface comprises 9 pins, except that the miniSD card adds two unconnected pins in the center and the microSD card omits one of the two VSS (Ground) pins.SD card pin assignment | miniSD card pin assignment | microSD card pin assignment |
---|---|---|
Various SD cards may support various combinations of the following bus types and transfer modes. The SPI bus and one-bit SD bus are mandatory for all SD families, as explained in the next section.
- SPI: Serial Peripheral Interface Bus is primarily used by embedded microcontrollers. This bus type supports only a 3.3-volt interface.
- One-bit SD: Separate command and data channels and a proprietary transfer format.
- Four-bit SD: Uses extra pins plus some reassigned pins. UHS-I and UHS-II requires this bus type.
Notes:
- Direction is relative to card. I = Input, O = Output.
- PP = Push-Pull logic, OD = Open-Drain logic.
- S = Power Supply, NC = Not Connected (or logical high).
Interface
- Command interface
Through issuing various commands, the host device can:
nside a 512 MB SD card: NAND flash chip that holds the data (bottom) and SD controller (top) |
- Determine the type, memory capacity, and capabilities of the SD card
- Command the card to use a different voltage, different clock speed, or advanced electrical interface
- Prepare the card to receive a block to write to the flash memory, or read and reply with the contents of a specified block.
- Electrical interface
Inside a 2 GB SD card: two NAND flash chips (top and middle), SD controller chip (bottom) |
At initial power-up or card insertion, the host device selects either the Serial Peripheral Interface (SPI) bus or the one-bit SD bus by the voltage level present on Pin 1. Thereafter, the host device may issue a command to switch to the four-bit SD bus interface, if the SD card supports it. For various card types, support for the four-bit SD bus is either optional or mandatory.
After determining that the SD card supports it, the host device can also command the SD card to switch to a higher transfer speed. Until determining the card's capabilities, the host device should not use a clock speed faster than 400 kHz. SD cards other than SDIO (see below) have a Default Speed clock rate of 25 MHz. The host device is not required to use the maximum clock speed that the card supports. It may operate at less than the maximum clock speed to conserve power. Between commands, the host device can stop the clock entirely.
The SDIO family comprises Low-Speed and Full-Speed cards. Both types of SDIO cards support SPI and one-bit SD bus types. Low-Speed SDIO cards are allowed to also support the four-bit SD bus; Full-Speed SDIO cards are required to support the four-bit SD bus. To use a SDIO card as a "combo card" (for both memory and I/O), the host device must first select four-bit SD bus operation. Two other unique features of Low-Speed SDIO are a maximum clock rate of 400 kHz for all communications, and the use of Pin 8 as "interrupt" to try to initiate dialogue with the host device.
- Ganging cards together
The SD protocol envisaged the ability to gang 30 cards together without separate chip select lines. The host device would broadcast commands to all cards and identify the card to respond to the command using its unique serial number.
In practice, cards are rarely ganged together because open-collector operation has problems at high speeds and increases power consumption. Newer versions of the SD specification recommend separate lines to each card.
- Achieving higher card speeds
File system
Like other types of flash memory card, an SD card of any SD family is a block-addressable storage device, in which the host device can read or write fixed-size blocks by specifying their block number.- MBR and FAT
- For SDSC cards: FAT16
- For SDHC cards: FAT32
- For SDXC cards: exFAT
On such SD cards, standard utility programs such as Mac OS X's "Disk Utility" or Windows' SCANDISK can be used to repair or retrieve corrupted data, and sometimes recover deleted files. Defragmentation tools for FAT file systems may be used on such cards. The resulting consolidation of files may provide a marginal improvement in the time required to read or write the file, but not an improvement comparable to defragmentation of hard drives, where storing a file in multiple fragments may involve a time penalty to move between physical areas of the drive. Moreover, defragmentation performs writes to the SD card that count against the card's rated lifespan. The write endurance of the physical memory is discussed in the article on flash memory; newer technology to increase the storage capacity of a card currently provides worse write endurance.
When reformatting an SD card smaller than 4 GB, FAT16 should be used. (This is also an option for 4 GB cards, but it requires the use of 64 kiB clusters, which are not widely supported.) FAT16 does not support cards above 4 GB.
The SDXC specification makes Microsoft's proprietary exFAT file system mandatory, which is supported only by some proprietary operating systems.
- Other file systems
- Under Unix-like operating systems such as Linux or FreeBSD, SD cards can be formatted using the UFS, EXT3, ext4, btrFS, HFS Plus, or the ReiserFS file systems.
- Under Mac OS X, SD cards can be partitioned as GUID devices and formatted with the HFS Plus file system.
- Under Windows and some Unix systems, SD cards can be formatted using NTFS and, on later versions, exFAT.
- Risks of reformatting
Power use
The power consumption of microSD cards varies by manufacturer, but appears to be in the range of 66-330 mW (20-100 mA at a supply voltage of 3.3 V). Specifications from TwinMos technologies list a maximum of 149 mW (45 mA) during transfer. Toshiba, on the other hand, lists 264-330 mW (80-100 mA).