CMD0: 0x00000000, ARG: 0x00000000 SRS12=0x0 SRS09=0x1ff0000 Info @L99
CMD8: 0x081a0000, ARG: 0x000001aa SRS12=0x0 SRS09=0x1ff0000 Info @L99 resp48 [0]=0x1aa
CMD55: 0x371a0000, ARG: 0x00000000 SRS12=0x0 SRS09=0x1ff0000 Info @L99 resp48 [0]=0x120 mmc_detect_card: MMC_CMD55 try SD_CARD
CMD41: 0x29020000, ARG: 0x40ff8000 SRS12=0x0 SRS09=0x1ff0000 Info @L99 resp48 [0]=0xff8000
CMD55: 0x371a0000, ARG: 0x00000000 SRS12=0x0 SRS09=0x1ff0000 Info @L99 resp48 [0]=0x120
CMD41: 0x29020000, ARG: 0x40ff8000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0xff8000
CMD55: 0x371a0000, ARG: 0x00000000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x120
CMD41: 0x29020000, ARG: 0x40ff8000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0xff8000
CMD55: 0x371a0000, ARG: 0x00000000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x120
CMD41: 0x29020000, ARG: 0x40ff8000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0xff8000
CMD55: 0x371a0000, ARG: 0x00000000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x120
CMD41: 0x29020000, ARG: 0x40ff8000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0xff8000
CMD55: 0x371a0000, ARG: 0x00000000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x120
CMD41: 0x29020000, ARG: 0x40ff8000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x80ff8000
CMD2: 0x02090000, ARG: 0x00000000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp136[0]=0xa2008600
resp136[1]=0x38a22b84
resp136[2]=0x44303247
resp136[3]=0x2544d53
CMD3: 0x031a0000, ARG: 0x00000000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0xf7800520
mmc detect card: slot 0, type SD_CARD, mode BYTE_MODE
CMD9: 0x09090000, ARG: 0xf7800000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp136[0]=0x16800000
resp136[1]=0xffffff80
resp136[2]=0x5b5a83a9
resp136[3]=0x2e0032
CMD4: 0x04000000, ARG: 0x04040000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
CMD7: 0x071b0000, ARG: 0xf7800000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x700
csd version 0
c_size_mult 7, read_bl_len 10, card_size 3751
SetClk 25000=200000/8
CMD13: 0x0d1a0000, ARG: 0xf7800000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x900
CMD55: 0x371a0000, ARG: 0xf7800000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x920
CMD6: 0x061a0000, ARG: 0x00000002
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x920
CMD13: 0x0d1a0000, ARG: 0xf7800000
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x900
CMD16: 0x101a0000, ARG: 0x00000200
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x900
CMD17: 0x113a0010, ARG: 0x00002000
BlockCount=1, BlockSize=512
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x900
CMD17: 0x113a0010, ARG: 0x00000000
BlockCount=1, BlockSize=512
SRS12=0x0 SRS09=0x1ff0000 Info @L99
resp48 [0]=0x900
mmc0 size: 1876MB, 3842048 sectors, partition type DOS
mmc0 is available
其中:
cmd0: reset
Acmd41:获得SD卡的OCR;注意卡的工作电压,以及确认卡的工作类型SDIOHOST_CAPACITY_NORMAL或者SDIOHOST_CAPACITY_HIGH。
cmd 2 :获得SD卡的CID。
cmd3:获得SD卡的RCA。
cmd9: 获得SD卡的CSD。
CMD8:判断是否时MMC设备。
CMD1:判断是否时是SDIO设备。
CMD4:设置SD卡的工作频率。SET_DSR。
4.3 Data Transfer Mode
Until the end of Card Identification Mode the host shall remain at fOD frequency because some cards
may have operating frequency restrictions during the card identification mode. In Data Transfer Mode
the host may operate the card in fPP frequency range (see Chapter 6.6.6). The host issues SEND_CSD
(CMD9) to obtain the Card Specific Data (CSD register), e.g. block length, card storage capacity, etc.
The broadcast command SET_DSR (CMD4) configures the driver stages of all identified cards. It
programs their DSR registers corresponding to the application bus layout (length) and the number of
cards on the bus and the data transfer frequency. The clock rate is also switched from fOD to fPP at that
point. SET_DSR 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 (Note that it is the responsibility of the
Host to reserve the RCA=0 for card de-selection - refer to Table 4-21, CMD7.
cmd7:/// Command toggles a card between the stand-by and transfer states or between the programming and disconnect status
cmd13:Addressed card sends its status register.
Acmd6:Defines the data bus width ('00'=1bit or '10'=4 bits bus) to be used for data transfer. The allowed data bus widths are given in SCR register.
cmd16: sets the valid block length for block oriented data transfer。
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.
//
// *******************************************************************
//
// Copyright (c) 2011 Evatronix SA
//
// *******************************************************************
//
// Please review the terms of the license agreement before using
// this file. If you are not an authorized user, please destroy this
// source code file and notify Evatronix SA immediately that you
// inadvertently received an unauthorized copy.
//
// *******************************************************************
/// @file SDIO_CardGeneral.h
/// @brief SDIO card general definitions.
/// It contians card command definitions, card register
/// bit definitions and response types definitions
/// @version $Revision: 1.10 $
/// @author Piotr Sroka
/// @date $Date: 2011-08-12 14:07:30 $
// *******************************************************************
#ifndef SDIO_CARD_GENERAL_H
#define SDIO_CARD_GENERAL_H
//---------------------------------------------------------------------------
/// @name Commands definitions
//---------------------------------------------------------------------------
//@{
/// Reset SD card, go to idle state
#define SDIO_CMD0 0
/// Asks the card, in idle state, to send its Operating Conditions Register contents in the response on the SDIO_CMD line.
#define SDIO_CMD1 1
/// Asks the card to send its CID number on the SDIO_CMD line
#define SDIO_CMD2 2
/// Assigns relative address to the card
#define SDIO_CMD3 3
/// Programs the DSR of the card
#define SDIO_CMD4 4
/// It is used to inquire about the voltage range needed by the I/O card
#define SDIO_CMD5 5
/// Switch function command it is used to switch or expand memory card functions
#define SDIO_CMD6 6
/// Command toggles a card between the stand-by and transfer states or between the programming and disconnect states.
#define SDIO_CMD7 7
/// Sends SD Memory Card interface condition, which includes host supply voltage information and asks the card whether card supports voltage.
#define SDIO_CMD8 8
/// Addressed card sends its card-specific data (CSD) on the SDIO_CMD line.
#define SDIO_CMD9 9
/// Addressed card sends its card identification (CID) on SDIO_CMD the line.
#define SDIO_CMD10 10
/// Reads data stream from the card, starting at the given address, until a STOP_TRANSMISSION follows. (MMC card only)
#define SDIO_CMD11 11
/// Forces the card to stop transmission
#define SDIO_CMD12 12
/// Addressed card sends its status register.
#define SDIO_CMD13 13
/// A host reads the reversed bus testing data pattern from a card. (MMC card only)
#define SDIO_CMD14 14
/// Sets the card to inactive state
#define SDIO_CMD15 15
/// Setss the block length of the SD/SDIO card
#define SDIO_CMD16 16
/// Reads a block of the size selected by the SET_BLOCKLEN command.
#define SDIO_CMD17 17
/// Continuously transfers data blocks from card to host until interrupted by a stop command,
#define SDIO_CMD18 18
/// A host sends the bus test data pattern to a card. (MMC card only)
#define SDIO_CMD19 19
/// Writes a data stream from the host, starting at the given address, until a STOP_TRANSMISSION follows. (MMC card only)
#define SDIO_CMD20 20
/// Defines the number of blocks which are going to be transferred in the immediately succeeding multiple block read or write command.(MMC card only)
#define SDIO_CMD23 23
/// Writes a block of the size selected by the SET_BLOCKLEN command.
#define SDIO_CMD24 24
/// Continuously writes blocks of data until a STOP_TRANSMISSION follows or the requested number of block received.
#define SDIO_CMD25 25
/// Programming of the programmable bits of the CSD.
#define SDIO_CMD27 27
/// If the card has write protection features, this command sets the write protection bit of the addressed group.
#define SDIO_CMD28 28
/// If the card provides write protection features, this command clears the write protection bit of the addressed group.
#define SDIO_CMD29 29
/// Ask the card to send the status of the write protection. (If card support write protection)
#define SDIO_CMD30 30
/// Sets the address of the first write block to be erased.
#define SDIO_CMD32 32
/// Sets the address of the last write block of the continuous range to be erased.
#define SDIO_CMD33 33
/// Sets the address of the first write block to be erased for MMC device
#define SDIO_CMD35 35
/// Sets the address of the last write block of the continuous range to be erased for MMC device
#define SDIO_CMD36 36
/// Erases all previously selected write blocks.
#define SDIO_CMD38 38
/// Used to set/reset the password or lock/unlock the card. The size of the data block is set by the SET_BLOCK_LEN command.
#define SDIO_CMD42 42
/// Access a single register within the total 128K of register space
#define SDIO_CMD52 52
/// Extended access a single register within the total 128K of register space
#define SDIO_CMD53 53
/// Commmand informs that the next command is an application specific command rather than a standard command
#define SDIO_CMD55 55
/// 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.
#define SDIO_CMD56 56
/// Read OCR register in SPI mode
#define SDIO_CMD58 58
/// Turns the CRC option on or off in SPI mode
#define SDIO_CMD59 59
/// Set the data bus width.
#define SDIO_ACMD6 6
/// Read SD card status
#define SDIO_ACMD13 13
/// Command is used to get the number of the written (without errors) write blocks. Responds with 32bit+CRC data block.
#define SDIO_ACMD22 22
/// Set the number of write blocks to be preerased before writing
#define SDIO_ACMD23 23
/// Sends host capacity support information (HCS) and asks the accessed card
/// to send its operating condition register (OCR) content in the response on the CMD line.
#define SDIO_ACMD41 41
/// Connect[1]/Disconnect[0] the 50 KOhm pull-up resistor on CD/DAT3 (pin 1) of the card.
#define SDIO_ACMD42 42
/// Reads the SD Configuration Register (SCR).
#define SDIO_ACMD51 51
//}@
//---------------------------------------------------------------------------
看规范的P191.
7.3.1.3 Detailed Command Description