1、簡介
MMC卡: MultiMedia card,有 7 個(gè)觸點(diǎn)( 引腳),分為兩種操作模式,分別為 MMC模式與SPI 模式,兩種模式對引腳的定義是不同的。SPI 模式只有 Host 具有SPI 接口時(shí)才能使用。MMC只具有存儲(chǔ)功能,不像SD卡還具有加密功能。
SD卡: Security Digtial card,共有9 個(gè)觸點(diǎn)( 引腳),多余的 2 個(gè)引腳為數(shù)據(jù)線,但使用與 MMC卡兼容的模式時(shí),這兩個(gè)多余的引腳沒有起到作用。SD卡除了存儲(chǔ)功能外,還有一種加密功能,但加密功能是收費(fèi)的(所以開源的linux中只包含mmc的驅(qū)動(dòng)目錄),因?yàn)楫?dāng)初SD卡聯(lián)盟中(索尼)就是發(fā)明這種卡就是用來存儲(chǔ)音樂(淘汰卡帶),并使用加密特性,防止拷貝。
TF卡:軟件上SD卡一致,只是在硬件的體積上比SD卡西小,所以市場上很多的TF卡的SD外形卡套
SDIO卡:
3、SD卡協(xié)議
1.x:小于2GB的卡(但通過相關(guān)的軟件,可以模擬實(shí)現(xiàn)大于2GB)
2.0: 2<SD卡<32 GB
3.0: >32GB
4、SD卡通信接口
SD卡有9個(gè)pin:1個(gè)VDD,2個(gè)VSS(GND),CLK,CMD,DATA0-DATA3, 【DATA3可以作為卡檢測腳】
SD卡可以使用SD總線接口,也可以使用SPI通信接口;
SD總線接口描述:
CMD:Command is a bi-directional signal. (Host and card drivers are operating in push pull mode.) 【命令與響應(yīng)都是走這條線】
DAT0-3:Data lines are bi-directional signals. (Host and card drivers are operating in push pull
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卡內(nèi)部結(jié)構(gòu)
上電初始化需要1ms或者74 CLOCK(SD卡的clock,400KHZ)兩者大致,SD卡的電壓上到2.0V,SD卡開始工作,此時(shí)支持的命令非常有限(其中最主要支持ACMD41命令,sd host問卡的操作電壓時(shí)多少? 卡就會(huì)從它的OCR寄存器里面讀出SD卡出廠就燒錄在里面的卡的操作電壓值返回給sd host),當(dāng)電壓調(diào)整到它要求的VDD時(shí)候(SD卡的工作電壓在2.7~3.6V,常見3.3V),同時(shí)SD的CLK從400KHZ調(diào)整到更高頻率(比如25MHZ),這時(shí)卡就完全正常的工作了。接下來可以去獲取卡的生產(chǎn)廠家,容量等信息。
最多支持64個(gè)命令: CMD0~CMD63,(其中CMD57~63是保留的)
ACMD: Application Sepcific command:
ACMD41 =cmd55 + cmd41,組合命令,CMD55是前導(dǎo)命令,提醒卡后面的CMD41是一個(gè)特殊的命令
命令的類型
廣播命令(bc,bcr)——廣播命令發(fā)送給所有SD卡,有些命令需要響應(yīng)。
尋址(點(diǎn)對點(diǎn))命令
(ac,adtc)
——
尋址命令只發(fā)送給具有相應(yīng)地址的卡,并
需要從卡返回一個(gè)響應(yīng)。
R1 (standard response): response length 48 bit
R1b is identical to R1 with an optional busy signal 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 CMD2 and CMD10. The content of the CSD register is sentas a response to CMD9.
R3 (OCR register): response length 48 bits. The contents of the OCR register are sent as a response to ACMD41.
R4~R5: responses are not supported.
R6:(Published RCA response): code length 48-bit, response to CMD3
