新闻  |   论坛  |   博客  |   在线研讨会
S3c2410_SDIO_调试笔记
xiajiashan | 2012-08-28 15:16:02    阅读:1128   发布文章

作者:下家山

CMD5命令响应—与—S3C2410寄存器的对应关系

协议规定CMD5命令响应为R4,其响应格式为:

R4 响应格式

S

D

Reserved

C

Number

Of I/O

functions

Memory

present

Stuff

Bits

I/O OCR

Reserved

E

1 1 6 1 3 1 3 24 7 1

S(tart bit): Start bit. Always 0

D(irection): Direction. Always 0 indicates transfer from card to host

Reserved: Bits Reserved for future use. These bits shall be set to 1.

C(omplete): Set to 1 if card is ready to operate after initialization.

I/ OCR : See Table 1

Memory Present: Set to 1 if the card also contains SD memory . Set to 0 if the card is I/O only.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.

Stuff Bits : Not used ,shall be set to 0.

个人观点: R4的长度为48bit,因为很多位是固定的,因此,S3C2410把它做到了一个响应

寄存器中,即rSDIRSP0(响应寄存器0)。

发送CMD5命令后,通过Polling或interrupt方式读取rSDIRSP0中的值。我发

送CMD5(0x00000345)后得到的响应寄存器0的值为90FF8000。下面对90FF8000进行解码分析。

1 001 0 000 1111 1111 1000 0000 0000 0000

 

C

Number

Of I/O

functions

Memory

Present

Stuff

Bits

I/O OCR

1 3 1 3 24

C(omplete) == 1 表示初始化完成;

Number Of I/O functions == 001 表示此SDIO card所支持的功能号为0~1;

Memory Present == 0 表示 此卡仅为I/O卡;

Stuff Bits == 000 (本应该为000)

I/O OCR == FF8000对应到Table1 ,即此卡支持的电压范围为【2.7v~3.6v】

6.2 CMD52及响应剖析

10.jpg

rSDICARG[7:0]=====================CMD52[15:8](Write Data or Stuff Bits)

rSDICARG[8]=====================CMD52[16] (Stuff)

rSDICARG[25:9]=====================CMD52[33:17] (Register Address)

rSDICARG[26]=====================CMD52[34] (Stuff)

rSDICARG[27]=====================CMD52[35] (RAW flag)

rSDICARG[30:28]=====================CMD52[38:36] (FunctionNumber)

rSDICARG[31]=====================CMD52[39] (R/W flag)

rSDICCON[7:0]======================CMD5[47:40](S/D/command index)

 

 
11.jpg
12.jpg

 

13.jpg

 

6.2.1 S3c2410中,如何解读发送CMD52后的结果

在s3c2410中,解读任何一个命令发送后的状态是通过读取rSDICSTA(命令状态寄存器), rSDIRSP0-3(命令响应寄存器),然后分析的。以我读取conexant wifi SDIO card 出厂ID号为例,发送CMD52后,得到的这两个寄存器的值为:

rSDICSTA == 0x00000A34

rSDIRSP0 == 0x00001013

解码0x00000A34

0………..0 0 1 0 1 0 0011 0100

 

undefine

Response CRC Fail

Command Sent

Command Time Out

Response Receive End

CMD line progress

RspIndex

18 1 1 1 1 1 8

Command Sent == 1 表示命令已发送;

ResponseReceiveEnd == 1 表示命令响应结束;

RspIndex == 0x34 表示命令号为52(0x34)

这表明命令状态OK。

解码0x00001013

0……0 0 0 01 0 0 0 0 0001 0011

 

undefine

COM_CRC_ERROR

illegal_COMMAND

IO_CURRENT_STATE

ERROR

RFU

FUNCTION_NUMBER

OUT_OF_RANGE

Read or Write Data

16 1 1 2 1 1 1 1 8

IO_CURRENT_STATE == 01 表示 Execution CMD52 in CMD State;

Read or Write Data == 0x13 表示读出来的出厂ID号为0x13;

个人观点:CMD52 Response (R5)中的stuff域,E域因其值固定而在S3c2410中没有表现出来,而CRC7在rSDICSTA中有专门的crc位指示。而,S域,D域,CommandIndex域也在rSDICSTA中的【7:0】显示出来了,所以在rSDIRSP0中没有必要再显示这些值。

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
02年接触ARM和ucos,开发过有线和无线图像报警器,IPCamera,人脸识别系统,OCR识别系统,指纹识别系统,05年开始从事Linux及Rtems下WiFi,camera,Ethernet等驱动开发工作,专做嵌入式linux培训,致力于把我十年来的研发经验传授给每一个学员,招人的可以找我,ximenpiaoxue4016@sina.com
推荐文章
最近访客