Chapter 5 – SPI Protocol
Revision 2.2
SD Card Product Manual
© 2004 SanDisk Corporation
5-8
12/08/04
5.17 SPI Command Set
The following sections provide valuable information on the SPI Command Set.
5.17.1 Command
Format
All SD Card commands are six bytes long and transmitted MSB first.
Commands and arguments are listed in Table 5-2.
7-bit CRC Calculation: G(x) = x
7
+ x
3
+ 1
M(x) = (start bit)*x
39
+ (host bit)*x
38
+...+ (last bit before CRC)*x
0
CRC[6...0] = Remainder[(M(x)*x
7
)/G(x)]
5.17.2 Command
Classes
As in SD mode, the SPI commands are divided into several classes (See Table 5-1). Each
class supports a set of card functions. A SD Card will support the same set of optional
command classes in both communication modes (there is only one command class table in
the CSD register). The available command classes, and the supported commands for a
specific class, however, are different in the SD Memory Card and the SPI communication
mode.
Note that except the classes that are not supported in SPI mode (class 1, 3 and 9), the
mandatory required classes for the SD mode are the same for the SPI mode.
Table 5-1
Command Classes in SPI Mode
CCC
0 1 6 9 10 12 13 16 17 18 24 25 27 28 29 30 32 33 34 35 36 37 38 42 50 52 53 55 56 57 58 59
0
Basic
+ + + + + +
+ +
1
NS
2
Block read
+ + +
3
NS
4
Block write
+ + + +
5
Erase
+ +
+
6
Write-
protect
+ + +
7
Lock card
+
+
8
App-
specific
+ +
9
I/O mode
+ +
10
Switch
+ + + + + + +
11
R
Key:
NS = Not supported in SPI mode.
R = Reserved
Byte 1
Byte 2-5
Byte 6
7 6
5
0
31
7
0
0
1
CRC
Command Argument
Command
0 1