SDIO总线有各种状态,在不同的状态下,响应的命令也不相同。若在一种状态下,接收到了一个该状态下不响应的命令,就不会回应该命令,也不进行任何处理。如在“Initialization State”接收到CMD52,就不会回应,也不会执行任何动作。
图3 总线状态图及可接收的命令 2.2 SDIO命令
SDIO的命令、数据收发几种方式(如下图):
A、 单命令没有回应;
B、 命令加回应;
C、 命令+回应+数据(1个block,指定发送1个block);
D、 命令+回应+数据(多个block,指定发送n个block);
E、 命令+回应+数据+命令+回应(后一个命令+回应用于结束数据传输,发送n个block,直到发送停止传输命令为止);
图5 (Multiple) Block Read Operation
图6 (Multiple) Block Write Operation
命令、应答、data之间的时间关系
图7 timing value
个别命令、应答格式
CMD3(SEND_RELATIVE_ADDR ):
CMD3用于读取卡的RCA(Relative Card Address register ),该命令不需要参数,如下图,Command index为0x03,Argument为0x00。
CMD3的Response(R6):
CMD5(IO_SEND_OP_COND):
CMD5用于获取OCR(Operation Conditions Register )及设备配置;
CMD5的Response(R4)
其它位定义如下:
Stuff Bits: Not used, shall be set to 0.
S18R: Switching to 1.8V Request
C: Set to 1 if Card is ready to operate after initialization
Number of I/O Functions:
Indicates the total number of I/O functions supported by this card. The range is
0-7. Note that the common area present on all I/O cards at Function 0 is not
included in this count. The I/O functions shall be implemented sequentially
beginning at function 1.
Memory Present:
Set to 1 if the card also contains SD memory. Set to 0 if the card is I/O only.
OCR的定义如下:
表14 OCR Values for CMD5
CMD52(IO_RW_DIRECT):
The IO_RW_DIRECT is the simplest means to access a single register within the total 128K of register space in any I/O function, including the common I/O area (CIA).
CMD52的response(R5):
其它位定义如下:
R/W Flag: 读写控制为,0:读,1:写;
RAW Flag: 写后回读,当R/W Flag为1时,RAW Flag为1时,写发送完成后,在response中返回写入的数据;
Response Flags:
8 Bits of flag data indicating the status of the SDIO card. Table 5-1 shows the format of these flag bits.
表15 Flag Data for IO_RW_DIRECT SD Response