[SDIO]Read Wait 读等待机制

sdio 协议的read wait机制相当于是一个流控功能。在执行多块读后,sd卡会在每一个SDCLK持续发送数据。如果host内部的DMA或CPU已经来不及搬运这些数据了,导致controller 的buffer overflow,数据将会出现丢失。

解决办法1: host controller 在buffer 满时关闭SDCLK,sd卡没有clk驱动,会暂停数据发送。但是SDCLK关闭时无法发送其他CMD。

如下图,host 发送read mul-block 后,sd卡在每一个SDCLK都会发送数据。当host来不及处理时,会暂停发送SDCLK(蓝框部分),之前数据处理完成之后在可以接收数据时恢复SDCLK.

 

解决办法2:通过一个信号告诉SD卡,我已经来不及处理这些数据了,请暂停,这个就是read wait机制。

《SD Card Specification》中关于Read Wait 的描述:

6.5 Read Wait (Optional)
Host devices built to the SD Physical specification version 1.01 must control the SDCLK to stop the read data
block output from a card executing a multiple read command whenever the host cannot accept more data.
During the time that the host has stopped the SDCLK, a CMD52 cannot be issued. This limitation causes a
problem in that a host device built to the SD Physical specification version 1.01 cannot perform the I/O
command during a multiple read cycle.
In order to eliminate this limitation, the SDIO specification adds the read wait control to enable the host to issue
CMD52 during a multiple read cycle. Read Wait uses the DAT[2] line to allow the host to signal the card to
temporarily halt the sending of read data by a card. This feature is optional for an SDIO or combo card.
However, if an SDIO or combo supports Read Wait, all functions and any memory must support read wait.
Note that Read Wait is defined only for the SD 1 and 4-bit modes. It does not apply to SPI transfers.
To determine if a card supports the Read Wait protocol, the host must test SRW capability bit in the Card
Capability byte of the CCCR. If a card does not support the Read Wait protocol, the only means a host has to
stall (not abort) data in a read multiple command is to control the SDCLK.

翻译:

根据SD物理规范1.01版,主机设备必须控制SDCLK,以便在主机无法接受更多数据时,使执行多块读命令的卡暂停发送数据块的输出。

在主机停止SDCLK期间,无法发出CMD52。这一限制导致了一个问题,在一个多块读周期中,按照SD物理规范版本1.01构建的主机设备无法执行I/O命令。

为了消除这种限制,SDIO规范添加了读等待特性,以使主机能够在一个多块读周期中发出CMD52。Read Wait使用DAT[2]行来允许主机向卡发出信号,让卡暂时停止发送读数据。这个功能对于SDIO或combo卡是可选的。

但是,如果SDIO或combo支持读等待,那么所有函数和内存都必须支持读等待。

注意,Read Wait只在sd1和4位模式下定义。它不适用于SPI传输。

要确定卡是否支持读等待协议,主机必须在CCCR的卡功能字节中测试SRW功能位。如果卡不支持读等待协议,那么在Read multiple命令中,主机必须停止(而不是终止)数据的唯一方法就是控制SDCLK。

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值