SanDisk SDMB-16-771 Product Manual - Page 61

SPI Protocol Definition

Page 61 highlights

MultiMediaCard Product Manual 6.0 SPI Protocol Definition 6.1 SPI Bus Protocol While the MultiMediaCard channel is based on command and data bit-streams which are initiated by a start bit and terminated by a stop bit, the SPI channel is byte oriented. Every command or data block is built of 8 bit bytes and is byte aligned (multiples of 8 clocks) to the CS signal. Similar to the MultiMediaCard protocol, the SPI messages are built from command, response and data-block tokens. All communication between host and cards is controlled by the host (master). The host starts every bus transaction by asserting the CS signal low. The response behavior in SPI mode differs from the MultiMediaCard mode in the following three aspects: • The selected card always responds to t h e command. • An 8 or 16 bit response structure is used. • When the card encounters a data retrieval problem, it will respond with an error response (which replaces the expected data block) rather than time-out as in t h e MultiMediaCard mode. Only single block read write operations are supported in SPI mode. In addition to t h e command response, every data block sent to t h e card during write operations will be responded with a special data response token. A data block may be as big as one card sector and as small as a single byte.1 6.1.1 Mode Selection The MultiMediaCard wakes up in t h e MultiMediaCard mode. It will enter SPI mode i f the CS signal is asserted (negative) during t h e reception of the reset command (CMD0). If t h e card recognizes that the MultiMediaCard mode is required it will not respond to the command and remain in the MultiMediaCard mode. If SPI mode is required, the card will switch to SPI mode and respond with the SPI mode R1 response. The only way to return to the MultiMediaCard mode is by power cycling the card. In SPI mode, the MultiMediaCard protocol state machine is not observed. All the MultiMediaCard commands supported in SPI mode are always available. The CMD (pin 2) and DAT[0] (pin 7) lines start up in "Open Drain"2 mode and must be sourced externally. Once the card is in SPI mode, the lines are in "push-pull" mode until power is cycled. Since the card defaults to MultiMediaCard mode after a power cycle, Pin 1 (CS) must be pulled low and CMD0 (40h) must be sent on the CMD (DataIn, pin 2) line in order for the card to enter SPI mode. The default command structure/protocol for MultiMediaCard mode is to have CRC checking enabled. The default command structure/protocol for SPI mode is that CRC checking is disabled. Since t h e card powers up in MultiMediaCard mode, CMD0 must be followed by a valid CRC byte (even though the command is sent using the SPI structure). Once in SPI mode, CRCs are disabled by default. CMD0 is a static command and always generates the same 7 bit CRC of 4Ah. Adding the "1," end bit (bit 0) to the CRC creates a CRC byte of 95h. The following hexidecimal sequence can be used to send CMD0 in all situations for SPI mode, since the CRC byte (although required) is ignored once in SPI mode. The entire CMD0 sequence appears as 40 00 00 00 00 95 (hexidecimal). 1) The default block length is as specified in the CSD (512 bytes). A set block length of less than 512 bytes will cause a write error. The only valid write set block length is 512 bytes. CMD16 is not mandatory if the default is accepted. 2) See section 4.2. SanDisk MultiMediaCard Product Manual Rev. 2 © 2000 SANDISK CORPORATION 61

  • 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

MultiMediaCard Product Manual
SanDisk MultiMediaCard Product Manual Rev. 2 © 2000 SANDISK CORPORATION
61
6.0
SPI Protocol Definition
6.1
SPI Bus Protocol
While the MultiMediaCard channel is based on
command
and
data
bit-streams
which
are
initiated by a start bit and terminated by a stop
bit, the SPI channel is byte oriented. Every
command or data block is built of 8 bit bytes and is
byte aligned (multiples of 8 clocks) to the CS
signal.
Similar to the MultiMediaCard protocol, the SPI
messages are built from command, response and
data-block tokens. All communication between
host and cards is controlled by the host (master).
The host starts every bus transaction by asserting
the CS signal low.
The response behavior in SPI mode differs from
the MultiMediaCard mode in the following three
aspects:
The selected card always responds to the
command.
An 8 or 16 bit response structure is used.
When the card encounters a data retrieval
problem, it will respond with an error
response (which
replaces the expected
data block) rather than time-out as in the
MultiMediaCard mode.
Only single block read write
operations are
supported in SPI
mode. In addition
to
the
command response, every data block sent to t h e
card during write operations will be responded
with a special data response token. A data block
may be as big as one card sector and as small as a
single byte.
1
6.1.1
Mode Selection
The
MultiMediaCard
wakes
up
in
the
MultiMediaCard mode. It will enter SPI mode i f
the CS signal is asserted (negative) during the
reception of the reset command (CMD0). If the
card recognizes that the MultiMediaCard mode is
1)
The default block length is as specified in the CSD
(512 bytes). A set block length of less than 512
bytes will cause a write error. The only valid write
set block length is 512 bytes. CMD16 is not
mandatory if the default is accepted.
required it will not respond to the command and
remain in the MultiMediaCard mode. If SPI mode
is required, the card will switch to SPI mode and
respond with the SPI mode R1 response.
The only way to return to the MultiMediaCard
mode is by power cycling the card. In SPI mode,
the MultiMediaCard protocol state machine is not
observed. All the MultiMediaCard
commands
supported in SPI mode are always available.
The CMD (pin 2) and DAT[0] (pin 7) lines start up
in “Open Drain”
2
mode and must be sourced
externally. Once the card is in SPI mode, the lines
are in “push-pull” mode until power is cycled.
Since the card defaults to MultiMediaCard mode
after a power cycle, Pin 1 (CS) must be pulled low
and CMD0 (40h) must be sent on the CMD (DataIn,
pin 2) line in order for the card to enter SPI mode.
The
default
command
structure/protocol
for
MultiMediaCard mode is to have CRC checking
enabled.
The default command structure/protocol for SPI
mode is that CRC checking is disabled. Since the
card powers up in MultiMediaCard mode, CMD0
must be followed by a valid CRC byte (even
though the
command is sent using the
SPI
structure). Once in SPI mode, CRCs are disabled by
default.
CMD0 is a static command and always generates
the same 7 bit CRC of 4Ah. Adding the “1,” end
bit (bit 0) to the CRC creates a CRC byte of 95h.
The following hexidecimal sequence can be used to
send CMD0 in all situations for SPI mode, since
the CRC byte (although required) is ignored once
in SPI mode. The entire CMD0 sequence appears as
40 00 00 00 00 95 (hexidecimal).
2)
See section 4.2.