• 沒有找到結果。

7. SPI Mode

7.3 SPI Mode Transaction Packets

7.3.1 Command Tokens

7.3.1.3 Detailed Command Description

The following table provides a detailed description of the SPI bus commands. The responses are defined in Chapter 7.3.2. Table 7-3 lists all SD Memory Card commands. A “yes” in the SPI mode column indicates that the command is supported in SPI mode. With these restrictions, the command class description in the CSD is still valid. If a command does not require an argument, the value of this field should be set to zero. The reserved commands are reserved in SD mode as well.

The binary code of a command is defined by the mnemonic symbol. As an example, the content of the command index field is (binary) ‘000000’ for CMD0 and ‘100111’ for CMD39.

The card shall ignore stuff bits and reserved bits in a argument.

CMD INDEX

SPI

Mode Argument Resp Abbreviation Command Description CMD0 Yes [31:0] stuff bits R1 GO_IDLE_STATE Resets the SD Memory Card

CMD1 Yes1 [31]Reserved bit [30]HCS

[29:0]Reserved bits

R1 SEND_OP_

COND

Sends host capacity support information and activates the card's initialization process.

HCS is effective when card receives SEND_IF_COND command.

Reserved bits shall be set to '0'.

CMD2 No CMD3 No CMD4 No

CMD5 Reserved for I/O Mode (refer to the "SDIO Card Specification")

CMD INDEX

SPI

Mode Argument Resp Abbreviation Command Description CMD68 Yes [31] Mode

0:Check function 1:Switch function

[30:24] reserved (All ’0’)

[23:20] reserved for function group 6 (All ’0’

or 0xF)

[19:16] reserved for function group 5 (All ’0’

or 0xF)

[15:12] reserved for function group 4 (All ’0’

or 0xF)

[11:8] reserved for function group 3 (All ’0’

or 0xF)

[7:4] function group 2 for command system

[3:0] function group 1 for access mode

R1 SWITCH_FUNC Checks switchable function (mode 0) and switches card function (mode 1).

See Chapter 4.3.10.

CMD7 No

CMD89 Yes [31:12]Reserved bits

[11:8]supply voltage(VHS) [7:0]check pattern

R7 SEND_IF_COND Sends SD Memory Card interface condition that includes host supply voltage information and asks the

accessed card whether card can operate in supplied voltage range.

Reserved bits shall be set to '0'.

CMD9 Yes [31:0] stuff bits R1 SEND_CSD Asks the selected card to send its card-specific data (CSD)

CMD10 Yes [31:0] stuff bits R1 SEND_CID Asks the selected card to send its card identification (CID)

CMD INDEX

SPI

Mode Argument Resp Abbreviation Command Description CMD12 Yes [31:0] stuff bits R1b5 STOP_

TRANSMISSION

Forces the card to stop transmission in Multiple Block Read Operation

CMD13 Yes [31:0] stuff bits R2 SEND_STATUS Asks the selected card to send its status register.

CMD14 reserved CMD15 No

CMD16 Yes [31:0] block length

R1 SET_BLOCKLEN Sets a block length (in bytes) for all following block commands (read and write)2 of a Standard Capacity Card.

Block length of the read and write commands are fixed to 512 bytes in a High Capacity Card. The length of LOCK_UNLOCK command is set by this command in both capacity cards.

CMD17 Yes [31:0] data address10

R1 READ_SINGLE_

BLOCK

Reads a block of the size selected by the SET_BLOCKLEN command.3

CMD18 Yes [31:0] data address10

R1 READ_MULTIPLE _BLOCK

Continuously transfers data blocks from card to host until interrupted by a STOP_TRANSMISSION command.

CMD19 reserved CMD20 No CMD21...

CMD23 reserved

CMD24 Yes [31:0] data address10

R1 WRITE_BLOCK Writes a block of the size selected by the SET_BLOCKLEN command.4

CMD25 Yes [31:0] data address10

R1 WRITE_MULTIPLE _BLOCK

Continuously writes blocks of data until ’Stop Tran’ token is sent (instead ’Start Block’).

CMD26 No

CMD27 Yes [31:0] stuff bits R1 PROGRAM_CSD Programming of the programmable bits of the CSD.

CMD28 Yes [31:0] data address

R1b5 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).

The High Capacity Card does not support this command.

CMD29 Yes [31:0] data address

R1b5 CLR_WRITE_

PROT

If the card has write protection features, this command clears the write protection bit of the addressed group. The High Capacity Card does not support this command.

CMD INDEX

SPI

Mode Argument Resp Abbreviation Command Description CMD30 Yes [31:0] write

protect data address

R1 SEND_WRITE_

PROT

If the card has write protection features, this command asks the card to send the status of the write protection bits.6 The High Capacity Card does not support this command.

CMD31 reserved

CMD32 Yes [31:0] data address10

R1 ERASE_WR_BLK_

START_ADDR

Sets the address of the first write block to be erased.

CMD33 Yes [31:0] data address10

R1 ERASE_WR_BLK_

END_ADDR

Sets the address of the last write block of the continuous range to be erased.

CMD34...

CMD378

Reserved for each command system set by switch function command (CMD6).

Refer to each command system specification for more detail.

CMD38 Yes [31:0] stuff bits R1b5 ERASE Erases all previously selected write blocks

CMD39 No CMD40 No CMD41 Reserved

CMD42 Yes [31:0] Reserved bits (Set all 0)

R1 LOCK_UNLOCK Used to Set/Reset the Password or lock/unlock the card. A transferred data block includes all the command details - refer to Chapter 4.3.7. The size of the Data Block is defined with

SET_BLOCK_LEN command.

Reserved bits in the argument and in Lock Card Data Structure shall be set to 0.

CMD43-49

CMD51 reserved

CMD508 Reserved for each command system set by switch function command (CMD6).

Refer to each command system specification for more detail.

CMD52...

CMD54 Reserved for I/O Mode (refer to the "SDIO Card Specification")

CMD55 Yes [31:0] stuff bits R1 APP_CMD Defines to the card that the next com-mand is an application specific comcom-mand rather than a standard command

CMD56 Yes [31:1] stuff bits.

[0]: RD/WR7

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 case of Standard Capacity SD Memory Card, the size of the Data Block shall be defined with SET_BLOCK_LEN command. Block

CMD INDEX

SPI

Mode Argument Resp Abbreviation Command Description CMD578 Reserved for each command system set by switch function command (CMD6).

Refer to each command system specification for more detail.

CMD58 Yes [31:0] stuff bits R3 READ_OCR Reads the OCR register of a card. CCS bit is assigned to OCR[30].

CMD59 Yes [31:1] stuff bits [0:0] CRC

option

R1 CRC_ON_OFF Turns the CRC option on or off. A ‘1’ in the CRC option bit will turn the option on, a ‘0’ will turn it off

CMD60-63 Reserved For Manufacturer

1. CMD1 is valid command for the Thin (1.4mm) Standard Size SD Memory Card only if used after re-initializing a card (not after power on reset).

2. The default block length is as specified in the CSD.

3. The data transferred shall not cross a physical block boundary unless READ_BLK_MISALIGN is set in the CSD.

4. The data transferred shall not cross a physical block boundary unless WRITE_BLK_MISALIGN is set in the CSD.

5. R1b: R1 response with an optional trailing busy signal

6. 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 zero

7. RD/WR_: “1” the Host shall get a block of data from the card.

“0” the host sends block of data to the card.

8. This command was added in spec version 1.10 9. This command is added in spec version 2.00

10. The unit of “data address” in argument is byte for Standard Capacity SD Memory Card and block (512 bytes) for High Capacity SD Memory Card.

Table 7-3: Commands and Arguments

The following table describes all the application specific commands supported/reserved by the SD Memory Card. All the following commands shall be preceded with APP_CMD (CMD55).

CMD INDEX

SPI

Mode Argument Resp Abbreviation Command Description ACMD6 No

ACMD13 yes [31:0] stuff bits R2 SD_STATUS Send the SD Status. The status fields are given in Table 4-37

ACMD17 reserved

ACMD18 yes -- -- -- Reserved for SD security

applications1 ACMD19-

ACMD21

reserved

ACMD22 yes [31:0] stuff bits R1 SEND_NUM_WR_B LOCKS

Send the numbers of the well written (without errors) blocks. Responds with 32-bit+CRC data block.

ACMD23 yes [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 com-mand). “1”=default (one wr block)(2). ACMD24 reserved

ACMD25 yes -- -- -- Reserved for SD security

applications1

ACMD26 yes -- -- -- Reserved for SD security

applications1

ACMD38 yes -- -- -- Reserved for SD security

applications1 ACMD39 -

ACMD40

reserved

ACMD41 Yes [31]Resetved bit [30]HCS

[29:0]Reserved bits

R1 SD_SEND_OP_CO ND

Sends host capacity support information and activates the card's initialization process. Reserved bits shall be set to '0'

ACMD42 yes [31:1] stuff bits [0]set_cd

R1 SET_CLR_CARD_

DETECT

Connect[1]/Disconnect[0] the 50 KOhm pull-up resistor on CS (pin 1) of the card. The pull-up may be used for card detection.

ACMD43- ACMD49

yes -- -- -- Reserved for SD security

applications1

ACMD51 yes [31:0] staff bits R1 SEND_SCR Reads the SD Configuration Register (SCR).

(1) Refer to the “SD Specifications Part3 Security Specification” for detailed explanation about the SD Security Features (2) Stop Tran Token shall be used to stop the transmission in Write Multiple Block whether the pre-erase (ACMD23) feature

is used or not.

Table 7-4: Application Specific Commands used/reserved by SD Memory Card - SPI Mode

相關文件