SanDisk SDSDH-1024 Product Manual - Page 98

SPI Command Set

Page 98 highlights

Revision 2.2 Chapter 5 - SPI Protocol SD Card Product Manual 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. Byte 1 76 5 0 0 1 Command Byte 2-5 31 0 Command Argument Byte 6 7 0 CRC 1 Commands and arguments are listed in Table 5-2. 7-bit CRC Calculation: G(x) = x7 + x3 + 1 M(x) = (start bit)*x39 + (host bit)*x38 +...+ (last bit before CRC)*x0 CRC[6...0] = Remainder[(M(x)*x7)/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 Writeprotect +++ 7 Lock card + + 8 App- + + specific 9 I/O mode + + 10 Switch + ++++ + + 11 R Key: NS = Not supported in SPI mode. R = Reserved © 2004 SanDisk Corporation 5-8 12/08/04

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123

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