CMD:Command is a bi-directional signal. (Host and card drivers are operating in push pull mode.) 【命令与响应都是走这条线】
DAT0-3:Data lines are bi-directional signals. (Host and card drivers are operating in push pullmode.) 【真正的数据走这几条线,数据位是可以配置:1~4】
CLK:Clock is a host to cards signal. (CLK operates in push pull mode.)
VDD:VDD is the power supply line for all cards.
VSS[1:2]:VSS are two ground lines.
SPI接口描述:
CS:Host to card Chip Select signal.
CLK:Host to card clock signal.
DataIn:Host to card data signal.
DataOut:Card to host data signal.
5、SD卡内部结构
Each card has a set of information registers
The RCA register is not available in SPI Mode. OCR: 卡操作电压寄存器 32位, 只读,每隔0.1V占1位, 第31位卡上电过程是否完成 CID: 卡身份识别寄存器 128bit,只读, 厂家号,产品号,串号,生产日期 SCR: 卡配置寄存器, 可写的 64bit 是否用Security特性(LINUX不支持),以及数据位宽(1bit或4bit)
: 卡地址寄存器: 可写的 16bit SD host和卡进行协商的一个地址,内核中会在代码里面记录这个地址,卡这
边则写到RCA寄存器 CSD: 卡专有数据寄存器 部分可读写 128bit, 卡容量,最大传输速率,读写操作的最大电流、电压,读写擦出块的最大长度等 The host may reset the cards by switching the power supply off and on again. The card has its own power-on
detection circuitry which puts the card into an idle state after the power-on. The card can also be reset by sending
the GO_IDLE (CMD0) command.
5、SD卡上电过程
Broadcast Commands ( bc), no response
The broadcast feature is applicable only if all the CMD lines
are connected together in the host. If they are separated then each card will accept it separately on his
turn.
response from all cards simultaneously. Since there is no
Open Drain mode in SD Card, this type of command is used only if all the CMD lines are separated.
The command will be accepted and responded to by every card separately.
no data transfer on DAT.
data transfer on DAT
.
响应:R1 (standard response): response length 48 bit
R1b is identical to R1 with an optional transmitted on the data line
R2 (CID, CSD register): response length 136 bits.
The content of the CID register is sent as a response to . The content of the CSD register is sent
as a response to .
R3 (OCR register): response length 48 bits.
The co