0% found this document useful (0 votes)
407 views

SD Protocols Final PPT - Prepared - Without Flow Chart

The document discusses Secure Digital (SD) protocols. It describes the SD card interface which uses a 9-pin connection with power, clock and data lines. Communication can occur in SD mode or SPI mode. The SD card has a controller that mediates access to the memory core. The controller has registers like OCR, CID, CSD that store card information and status. Communication involves commands from the host to initiate operations like reading/writing data.

Uploaded by

alvin augustine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
407 views

SD Protocols Final PPT - Prepared - Without Flow Chart

The document discusses Secure Digital (SD) protocols. It describes the SD card interface which uses a 9-pin connection with power, clock and data lines. Communication can occur in SD mode or SPI mode. The SD card has a controller that mediates access to the memory core. The controller has registers like OCR, CID, CSD that store card information and status. Communication involves commands from the host to initiate operations like reading/writing data.

Uploaded by

alvin augustine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 46

SD Protocols

Presented by
Alvin Augustine
INTRODUCTION

• The Secure Digital Card is a flash-based memory card that is specifically designed
to meet the security, capacity, performance and environmental requirements
inherent in newly emerging audio and video consumer electronic devices.
• The SD Card communication is based on an advanced nine-pin interface (Clock,
Command, 4xData and 3xPower lines) designed to operate in a low voltage range.
• Communication with an SD card can be done in one of two modes: the SD mode
or the SPI mode. By default, the SD card operates in the SD mode. However, if a
simpler or slower bus is needed, the card can be configured for SPI mode.To
change it to SPI mode, a CS signal is asserted when the SD Card Controller asserts
a reset command. This protocol selection once done, cannot be undone or
changed until the next power cycle.
Block Diagram

• A block diagram of the SD card is shown in Fig.4. It consists of a 9-pin interface, a card
controller, a memory interface and a memory core. The 9-pin interface allows the
exchange of data between a connected system and the card controller.
• The SD Card Controller acts as a mediator between the master controller (processor)
and the SD card. It acts as an addressable sector which makes reading and writing data
from and to SD cards possible.
• The controller can read/write data from/to the memory core using the memory core
interface. In addition, several internal registers store the state of the card. The
controller responds to two types of user requests: control and data.
• Control requests set up the operation of the controller and allow access to the SD card
registers. Data requests are used to either read data from or write data to the memory
core.
SD Card Registers

• The device has six registers and two status information settings: OCR,
CID, CSD, RCA, DSR, SCR and Card Status, SD Status
• Secure Digital is divided into four categories based on their capacity and functions viz.
Standard Capacity (SDSC), High Capacity (SDHC), eXtended Capacity (SDXC), and SDIO.
The latter is used for data storage along with I/O functions. MMC card (Multimedia
Memory Card) was developed as an upgraded version of SDSC.
• The SD bus allows the dynamic configuration of the number of data lines from 1 to 4
bi-directional data signals. After power up, SD card will use only DAT0 by default. After
initialisation, the host can change the bus width.
• Multiple SD card connections are available to the host. Common Vdd, Vss and CLK
signal connections are available in the multiple connection. However, Command,
Response and Data lines (DAT0-DAT3) are divided for each card from the host.
Pinout
• Data: Data can be transferred from the card to the host or vice versa.
Data is transferred via the data lines.
SD Bus
• Communication over the SD bus is based on command and data bit streams that are
initiated by a start bit and terminated by a stop bit.
• Command : a command is a token that starts an operation. A command is sent from
the host either to a single card (addressed command) or to all connected cards
(broadcast command). A command is transferred serially on the CMD line.
• Response : a response is a token that is sent from an addressed card, or
(synchronously) from all connected cards, to the hosts as an answer to a previously
received command. A response is transferred serially on the CMD line.
• Data : data can be transferred from the card to the host or vice versa. Data is
transferred via the data lines.
SD Memory Card Functional Description

All communication between host and cards is controlled by the host (master). The host
send commands of two types: broadcast and addressed(point-to-point) commands.
Broadcast commands
Broadcast commands are intended for all cards. Some of these commands require a
response.
Addressed(point-to-point) commands
The addressed commands are sent to the addressed card and cause a response from this
card.
Card identification mode
The host will be in card identification mode after reset and while it is looking for new
cards on the bus. Cards will be in this mode after reset until the SEND RCA command
(CMD3) is received.
Data transfer mode
Cards will enter data transfer mode after their RCA is first published. The host will enter
data transfer mode after identifying all the cards on the bus.
 Card Identification Mode

• While in card identification mode the host resets all the cards that are in card
identification mode, validates operation voltage range, identifies cards and asks them
to publish Relative Card Address(RCA). This operation is done to each card separately
on its own CMD line. All data communication in the Card Identification Mode uses the
command line (CMD) only. During the card identification process, the card shall operate
in the SD clock frequency of the identificaiton clock rate.
Card Reset
• The command GOIDLESTATE(CMD0) is the software reset command and sets each card
into Idle State regardless of the current card state.
Operating Condition Validation
• The host issues a reset command (CMD0) with a specified voltage while assuming it may be
supported by the card.
• To verify the voltage, a following new command (CMD8) is defined
SENDIFCOND (CMD8) is used to verify SD Memory Card interface operating condition.
• The card checks the validity of operating condition by analyzing the argument of CMD8 and the
host checks the validity by analyzing the reponse of CMD8. The supplied voltage is indicated by
VHS filed in the argument. The card assumes the voltage specified in VHS as the current supplied
voltage. Only 1-bit of VHS shall be set to 1 at any given time.
• Both CRC and check pattern are used for the host to check validity of communication between
the host and the card. If the card cannot operate on the supplied voltage, it returns no response
and stays in idle state. It is mandatory to issue CMD8 prior to first ACMD41 for initialization of
High Capacity SD Memory Card.
• SDSENDOPCOND (ACMD41) is designed to provide SD Memory Card hosts with a mechanism to
identify and reject cards which do not match the VDD range desired by the host. Cards which
cannot perform data transfer in the specified range shall discard themselves from further bus
operations and go into Inactive STATE. Note that ACMD41 is application specific command,
therefore APPCMD (CMD55) shall always precede ACMD41.
Card Initialization and Identification
• The initialization process starts with SDSENDOPCOND (ACMD41) by setting its
operational conditions and the HCS bit in the OCR. The HCS (Host Capacity
Support) bit set to 1 indicates that the host supports High Capacity SD Memeory
card.
• The HCS (Host Capacity Support) bit set to 0 indicates that the host does not
support Hight Capacity SD Memory card.
 Data Transfer Mode
• The host issues SENDCSD(CMD9) to obtain the Card Specific Data(CSD register), e.g. block
length, card storage capacity, etc.
• The broadcast command SETDSR (CMD4) configures the driver stages of all identified cards.
It programs their DSR registers corresponding to the application bus layout and the
number of cards on the bus and the data transfer frequency.. SETDSR command is an option
for the card and the host.
• CMD7 is used to select one card and put it into the Transfer State. Only one card can be in
the Transfer State at a given time. If a previously selected card is in the Transfer State its
connection with the host is released and it will move back to the Stand-by State. When
CMD7 is issued with the reserved relative card address "0x0000", all cards are put back
to Stand-by State.
The relationship between the various data transfer modes is summarized below.

• All data read commands can be aborted any time by the stop command (CMD12). The
data transferwill terminate and the card will return to the Transfer State.
• The read command are: block read (CMD17), multiple block read (CMD18), send write
protect (CMD30), send scr (ACMD51) and general command in read mode (CMD56).
• All data write commands can be aborted any time by the stop command (CMD12). The
write commands shall be stopped prior to deselecting the card by CMD7. The write
commands are: block write (CMD24) and multiple block block write (CMD25)
• As soon as the data transfer is completed, the card will exit the data write state and move
either to the Programming State (transfer is successful) or Transfer State (transfer failed).
• If a block write operation is stopped and the block length and CRC of the last block are
valid, the data will be programmmed.
• The card may provide buffering for block write. This means that the next block can be sent
to the card while the previous is being programmed.
• If all write buffers are full, and as long as the card is in Programming State, the DAT0 line will be
kept low (BUSY).
• There is no buffering option for write CSD, write protection and erase. This means that while the
card is busy servicing any one of these commands, no other data transfer commands will be
accepted.
• DAT0 line will be kept low as long as the card is busy and in the Programming State. Actually if
the CMD and DAT0 lines of the cards are kept separated and the host keep the busy DAT0 line
disconnected from the other DAT0 lines(of the other cards) the host may access the other cards
while the card is in busy.
• Parameter set commands are not allowed while card is programming.
• Parmeter set commands are: set block length (CMD16), erase block start (CMD32) and erase
block end (CMD33).
• Read commands are not allowed while card is programming.
• Moving another card from Stand-by to Transfer State (using CMD7) will not terminate erase and
programming operations. The card will switch to the Disconnect State and will release the DAT
line.
• A card can be reselected while in the Disconnect State, using CMD7. In this case
the card will move to the Programming State and reactivate the busy indication.
• Resetting a card (using CMD0 or CMD15) will terminate any pending or active
programming operation. This may destroy the data contents on the card. It is the
host's responsibility to prevent this.
• CMD34-37, CMD50 and CMD57 are reserved for SD command system expansion.
State transitions for these commands are defined in each command system
specification.
Command Format

• All commands have a fixed code length of 48 bits, needing a transmission time of 1.92 us
@ 25 MHz and 0.96 us @ 50 MHz.
Detailed Command Description
Multiple Block Read
Multiple Block Write
Command Token Format
 Responses
• All responses are sent via the command line CMD. The response transmission
always starts with the left bit of the bit string corresponding to the response
codeword. The code length depends on the response type. There are five types of
responses for the SD Memory Card
R1 (normal response command):
• Code length is 48 bits. The bits 45:40 indicate the index of the command to be
responded to, this value being interpreted as a binary coded number (between 0
and 63). The status of the card is coded in 32 bits.
R1b
• R1b is identical to R1 with an optional busy signal transmitted on the data line. The
card may become busy after receiving these commands based on its state prior to the
command reception. The Host shall check for busy at the response.
R2 (CID, CSD register)
• Code length is 136 bits. The contents of the CID register are sent as a response to the
commands CMD2 and CMD10. The contents of the CSD register are sent as a response
to CMD9. Only the bits [127…1] of the CID and CSD are transferred, the reserved bit 1
 of these regisTers is replaced by the end bit of the response.
R3 (OCR register)
• Code length is 48 bits. The contents of the OCR register are sent as a response to
ACMD41.
R6 (Published RCA response)
• Code length is 48 bit. The bits 45:40 indicate the index of the Command to be
responded. he 16 MSB bits of the argument field are used for the Published RCA
number.
R7 (Card interface condition)
• Code length is 48 bits. The card support voltage information is sent by the response of
CMD8. Bits 19-16 indicate the voltage range that the card supports. The card that
accepted the supplied voltage returns R7 response. In the response, the card echoes back
both the voltage range and check pattern set in the argument.
Responses in SPI Mode

• There are several types of response tokens. As in SD mode, all are transmitted
MSB first.
• Multiple bytes responses are defined in SPI mode but the card outputs only first
byte (equivalent to R1) when Illegal Command Error or Command CRC Error is
indicated in it. In this case, host never reads as the multiple bytes of response.
Format R1

• This response token is sent by the card after every command with the exception of SEND_STATUS
commands. It is one byte long, and the MSB is always set to zero. The other bits are error indications,
an error being signaled by a 1. The structure of the R1 format is given in Figure 7-9. The meaning of
the flags is defined as following:
• In idle state: The card is in idle state and running the initializing process.
• Erase reset: An erase sequence was cleared before executing because an out of erase sequence
command was received.
• Illegal command: An illegal command code was detected.
• Communication CRC error: The CRC check of the last command failed.
• Erase sequence error: An error in the sequence of erase commands occurred.
• Address error: A misaligned address that did not match the block length was used in the command.
• Parameter error: The command's argument (e.g. address, block length) was outside the allowed range
for this card.
Format R1b
• This response token is identical to the R1 format with the optional addition of the
busy signal. The busy signal token can be any number of bytes. A zero value
indicates card is busy. A non-zero value indicates the card is ready for the next
command.
Format R2
• This response token is two bytes long and sent as a response to the SEND_STATUS
command. The format is given in Figure 7-10
The first byte is identical to the response R1. The content of the second byte is
described in the following:
• Erase param: An invalid selection for erase, sectors or groups.
• Write protect violation: The command tried to write a write-protected block.
• Card ECC failed: Card internal ECC was applied but failed to correct the data.
• CC error: Internal card controller error.
• Error: A general or an unknown error occurred during the operation.
• Write protect erase skip | lock/unlock command failed: This status bit has
two functions overloaded. It is set when the host attempts to erase a write-
protected sector or makes a sequence or password errors during card
lock/unlock operation.
• Card is locked: Set when the card is locked by the user. Reset when it is
unlocked.
Format R3

• This response token is sent by the card when a READ_OCR command is received.
The response length is 5 bytes (see Figure 7-11). The structure of the first (MSB)
byte is identical to response type R1. The other four bytes contain the OCR
register.
Format R7

• This response token is sent by the card when a SEND_IF_COND command (CMD8)
is received. The response length is 5 bytes. The structure of the first (MSB) byte is
identical to response type R1.
• The other four bytes contain the card operating voltage information and echo
back of check pattern in argument and are specified by the same definition as R7
response in SD mode
Detailed command description
The following list provide detailed description of the important SPI bus commands that are used while
interfacing SD card.
Thank You

You might also like