4. SD Memory Card Functional Description
4.7 Commands
4.7.4 Detailed Command Description
CMD
INDEX type argument resp abbreviation command description CMD15 ac [31:16] RCA
[15:0] reserved bits
- GO_INACTIVE_
STATE
Sends an addressed card into the Inactive State. This command is used when the host explicitly wants to deactivate a card.
Reserved bits shall be set to '0'.
Table 4-18: Basic Commands (class 0)
CMD
INDEX type argument resp abbreviation command description CMD16 ac [31:0] block length R1 SET_BLOCKLEN In the case of a Standard Capacity SD
Memory Card, this command sets the block length (in bytes) for all following block commands (read, write, lock).
Default block length is fixed to 512 Bytes.
Set length is valid for memory access commands only if partial block read operation are allowed in CSD.
In the case of a High Capacity SD
Memory Card, block length set by CMD16 command does not affect the memory read and write commands. Always 512 Bytes fixed block length is used. This command is effective for LOCK_UNLOCK command.
In both cases, if block length is set larger than 512Bytes, the card sets the BLOCK_LEN_ERROR bit.
CMD17 adtc [31:0] data address2
R1 READ_SINGLE_
BLOCK
In the case of a Standard Capacity SD Memory Card, this command, this command reads a block of the size selected by the SET_BLOCKLEN command. 1
In the case of a High Capacity Card, block length is fixed 512 Bytes regardless of the SET_BLOCKLEN command.
CMD18 adtc [31:0] data address2
R1 READ_MULTIPLE_
BLOCK
Continuously transfers data blocks from card to host until interrupted by a STOP_TRANSMISSION command.
Block length is specified the same as READ_SINGLE_BLOCK command.
CMD19 ...
CMD23
reserved
1) The data transferred shall not cross a physical block boundary unless READ_BLK_MISALIGN is set in the CSD.
2) Data address is in byte units in a Standard Capacity SD Memory Card and in block (512 Byte) units in a High Capacity SD Memory Card.
Table 4-19: Block-Oriented Read Commands (class 2)
CMD
INDEX type argument resp abbreviation command description CMD16 ac [31:0] block length R1 SET_BLOCKLEN See description in Table 4-19
CMD24 adtc [31:0] data address2
R1 WRITE_BLOCK In the case of a Standard Capacity SD Memory Card, this command writes a block of the size selected by the SET_BLOCKLEN command. 1 In the case of a High Capacity Card, block length is fixed 512 Bytes regardless of the SET_BLOCKLEN command.
CMD25 adtc [31:0] data address2
R1 WRITE_MULTIPLE _BLOCK
Continuously writes blocks of data until a STOP_TRANSMISSION follows.
Block length is specified the same as WRITE_BLOCK command.
CMD26 Reserved For Manufacturer
CMD27 adtc [31:0] stuff bits R1 PROGRAM_CSD Programming of the programmable bits of the CSD.
1) The data transferred shall not cross a physical block boundary unless WRITE_BLK_MISALIGN is set in the CSD. In the case that write partial blocks is not supported, then the block length=default block length (given in CSD).
2) Data address is in byte units in a Standard Capacity SD Memory Card and in block (512 Byte) units in a High Capacity SD Memory Card.
Table 4-20: Block-Oriented Write Commands (class 4)
CMD
INDEX type argument resp abbreviation command description CMD28 ac [31:0] data
address2
R1b SET_WRITE_PROT If the card has write protection features, this command sets the write protection bit of the addressed group. The
properties of write protection are coded in the card specific data
(WP_GRP_SIZE).
A High Capacity SD Memory Card does not support this command.
CMD29 ac [31:0] data address2
R1b CLR_WRITE_PROT If the card provides write protection features, this command clears the write protection bit of the addressed group.
A High Capacity SD Memory Card does not support this command.
CMD30 adtc [31:0] write protect data address2
R1 SEND_WRITE_
PROT
If the card provides write protection features, this command asks the card to send the status of the write protection bits.1
A High Capacity SD Memory Card does not support this command.
CMD31 reserved
1) 32 write protection bits (representing 32 write protect groups starting at the specified address) followed by 16 CRC bits are transferred in a payload format via the data line. The last (least significant) bit of the protection bits corresponds to the first addressed group. If the addresses of the last groups are outside the valid range, then the corresponding write protection bits shall be set to 0.
2) Data address is in byte units in a Standard Capacity SD Memory Card.
Table 4-21: Block Oriented Write Protection Commands (class 6)
CMD
INDEX type argument resp abbreviation command description CMD32 ac [31:0] data
address1
R1 ERASE_WR_BLK_
START
Sets the address of the first write block to be erased.
CMD33 ac [31:0] data address1
R1 ERASE_WR_BLK_END Sets the address of the last write block of the continuous range to be erased.
CMD38 ac [31:0] stuff bits R1b ERASE Erases all previously selected write blocks.
CMD39 reserved
CMD40 Not valid in SD Memory Card -
Reserved for MultiMediaCard I/O mode CMD41 reserved
1) Data address is in byte units in a Standard Capacity SD Memory Card and in block (512 Byte) units in a High Capacity SD Memory Card.
Table 4-22: Erase Commands (class 5)
CMD
INDEX type argument resp abbreviation command description CMD16 ac [31:0] block
length
R1 SET_BLOCKLEN See description in Table 4-19 CMD42 adtc [31:0] Reserved
bits (Set all 0)
R1 LOCK_UNLOCK Used to set/reset the password or lock/unlock the card. The size of the data block is set by the SET_BLOCK_LEN command.
Reserved bits in the argument and in Lock Card Data Structure shall be set to 0.
CMD43-49
CMD51 reserved
Table 4-23: Lock Card (class 7)
CMD
INDEX type argument resp abbreviation command description CMD55 ac [31:16] RCA
[15:0] stuff bits
R1 APP_CMD Indicates to the card that the next command is an application specific command rather than a standard command
CMD56 adtc [31:1] stuff bits.
[0]: RD/WR
R1 GEN_CMD Used either to transfer a data block to the card or to get a data block from the card for general purpose/application specific commands. In the case of a Standard Capacity SD Memory Cards, the size of the data block shall be set by the SET_BLOCK_LEN command. In the case of a High Capacity SD Memory Cards, the size of the data block is fixed to 512 byte. The host sets RD/WR=1 for reading data from the card and sets to 0 for writing data to the card.
CMD58-59 reserved
CMD60-63 reserved for manufacturer
Table 4-24: Application-specific Commands (class 8)
All the application-specific commands (given in Table 4-24) are supported if Class 8 is allowed (man-datory in SD Memory Card).
CMD
INDEX type argument resp abbreviation command description CMD52...
CMD54 reserved for I/O mode (refer to the "SDIO Card Specification") Table 4-25: I/O Mode Commands (class 9)
All future reserved commands shall have a codeword length of 48 bits, as well as their responses (if there are any).
The following table describes all the application-specific commands supported/reserved by the SD Memory Card. All the following ACMDs shall be preceded with APP_CMD command (CMD55).
ACMD
INDEX type argument resp abbreviation command description ACMD6 ac [31:2] stuff bits
[1:0]bus width
R1 SET_BUS_WIDTH Defines the data bus width (’00’=1bit or ’10’=4 bits bus) to be used for data transfer. The allowed data bus widths are given in SCR register.
ACMD13 adtc [31:0] stuff bits R1 SD_STATUS Send the SD Status. The status fields are given in Table 4-37.
ACMD17 reserved
ACMD18 -- -- -- -- Reserved for SD security applications1
ACMD19 to ACMD21
reserved
ACMD22 adtc [31:0] stuff bits R1 SEND_NUM_WR_
BLOCKS
Send the number of the written (without errors) write blocks. Responds with 32bit+CRC data block.
If WRITE_BL_PARTIAL='0', the unit of ACMD22 is always 512 byte.
If WRITE_BL_PARTIAL='1', the unit of ACMD22 is a block length which was used when the write command was executed.
ACMD23 ac [31:23] stuff bits [22:0]Number of blocks
R1 SET_WR_BLK_
ERASE_COUNT
Set the number of write blocks to be pre-erased before writing (to be used for faster Multiple Block WR command).
“1”=default (one wr block)
2
. ACMD24 reserved
ACMD25 -- -- -- -- Reserved for SD security applications1
ACMD26 -- -- -- -- Reserved for SD security applications1
ACMD38 -- -- -- -- Reserved for SD security applications1
ACMD39 to ACMD40
reserved
ACMD
INDEX type argument resp abbreviation command description ACMD41 bcr [31]reserved bit
[30]HCS(OCR[30]) [29:24]reserved bits [23:0] VDD Voltage Window(OCR[23:0])
R3 SD_SEND_OP_COND Sends host capacity support information (HCS) and asks the accessed card to send its operating condition register (OCR) content in the response on the CMD line. HCS is effective when card receives SEND_IF_COND command.
Reserved bit shall be set to ‘0’. CCS bit is assigned to OCR[30].
ACMD42 ac [31:1] stuff bits [0]set_cd
R1 SET_CLR_CARD_
DETECT
Connect[1]/Disconnect[0] the 50 KOhm pull-up resistor on CD/DAT3 (pin 1) of the card.
ACMD43 ACMD49
-- -- -- -- Reserved for SD security applications1
ACMD51 adtc [31:0] stuff bits R1 SEND_SCR Reads the SD Configuration Register (SCR).
1) Refer to the “SD Specifications Part3 Security Specification” for a detailed explanation about the SD Security Features 2) Command STOP_TRAN (CMD12) shall be used to stop the transmission in Write Multiple Block whether or not the
pre-erase (ACMD23) feature is used.
Table 4-26: Application Specific Commands used/reserved by SD Memory Card
Table 4-27 was added in version 1.10
CMD
INDEX type argument resp abbreviatio
n
command description CMD6 adtc [31] Mode
0:Check function 1:Switch function [30:24] reserved (All ’0’)
[23:20] reserved for function group 6 (0h or Fh) [19:16] reserved for function group 5 (0h or Fh) [15:12] reserved for function group 4 (0h or Fh) [11:8] reserved for function group 3 (0h or Fh) [7:4] function group 2 for command system [3:0] function group 1 for access mode
R1 SWITCH_F UNC
Checks switchable function (mode 0) and switch card function (mode 1).
See Chapter 4.3.10.
CMD34 CMD35 CMD36 CMD37 CMD50 CMD57
Reserved for each command system set by switch function command (CMD6).
Detailed definition is referred to each command system specification.
Table 4-27: Switch Function Commands (class 10)