首页 SPI总线协议

SPI总线协议

举报
开通vip

SPI总线协议 原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线协议 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! SD 卡规格书第五章 SPI 总线协议 译者注: 在本章节内,详细的描述了主控制器和 SD 卡之间,用 SPI ...

SPI总线协议
原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线 协议 离婚协议模板下载合伙人协议 下载渠道分销协议免费下载敬业协议下载授课协议下载 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! SD 卡规格书第五章 SPI 总线协议 译者注: 在本章节内,详细的描述了主控制器和 SD 卡之间,用 SPI 总线相互握手及通讯的 标准 excel标准偏差excel标准偏差函数exl标准差函数国标检验抽样标准表免费下载红头文件格式标准下载 和方法。 关于 SPI 总线拓扑的信息已经在第三章描述过了。 本章节的重点在于描述 SD 卡加电后的复位工作情况,如何进入 SPI 模式,如何用软件操作 SD 卡工作。以及 SD 卡是如何接收并响应主控制器的命令。它们之间的通讯产生错误的原因和处理的 相关办法。 其中还介绍了 SD 卡的命令集及其可实现的功能(SPI 模式下的命令集)。包括读取数据、写入 数据、擦除数据、保护数据等等,和这些命令所使用的方法和限制条件。 为了方便查阅,涉及到本章节内容的其它章节的一点资料被附加在本文的最后,如果没包括您 需要的信息,请您去查阅原文,谢谢! 注意:这篇译文的内容来自 SD 产品手册 2.2 版本。SD 组织对自己的技术资料是保密的,除了 他自己的客户外很难拿到。保护自己的技术产权无可厚非,但这样做不利于 SD 卡产品在中国国内 市场上的推广与使用,国内的电子 工程 路基工程安全技术交底工程项目施工成本控制工程量增项单年度零星工程技术标正投影法基本原理 师们还没有富裕的金钱去购买 SD 的技术,体制上受限又多, 语言也不通,很少能有渠道获得支持,想在自己设计的东西上加入对 SD 卡的支持都不容易。 这个版本已经很陈旧了,没有容量 2G 以上的标准。如果哪位朋友有新版的手册,请发布出来, 支持一下国内的电子爱好者,咱们又不想去另搞一个类似 SD 的组织同他抢饭碗,只不过想让自己 设计的东西上能顺利地用上 SD 卡而已。 醇酒 2007.12.2 我的个人空间:http://www.icdev.com.cn/?474/ 第 1 页 共 27 页 原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线协议 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! 醇酒 2007.12.2 我的个人空间:http://www.icdev.com.cn/?474/ 第 2 页 共 27 页 SPI 总线协议目录 5.1. SPI总线协议 5.1.1. 模式选择 5.1.2. 总线传送保护 5.1.3. 数据的读取 5.1.4. 数据写入 5.1.5. 擦除和写保护处理 5.1.6. 读取CID/CSD寄存器 5.1.7. 复位顺序 5.1.8. 时钟控制 5.1.9. 错误条件 5.1.9.1. CRC和无效指令 5.1.9.2. 读取、写入和擦除的超时情形 5.1.10. 存储器阵列分布 5.1.11. 卡的锁定/解锁 5.1.12. 特殊用途的命令集 5.1.13. 版权保护命令集 5.2. SPI命令设置 5.2.1. 命令格式 5.2.2. 命令类 5.2.2.1. 详细的命令描述 5.2.3. 应答 5.2.3.1 R1 的格式 5.2.3.2. R1b的格式 5.2.3.3. R2的格式 5.2.3.4. R3 的格式 5.2.3.5. 数据应答 5.2.4. 数据标记 5.2.5. 数据错误标记 5.2.6. 清除状态位 5.3. 卡寄存器 5.4. SPI总线时序图解 5.4.1. 命令 / 应答 5.4.2. 数据读取 5.4.3. 数据写入 5.4.4. 时钟数值 5.5. SPI 电气接口 5.6. SPI总线操作条件(环境) 5.7. 总线时钟 附录: 英文特殊命令 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 英文通用命令表 存储器阵列图 产品规格表 主控制器设计参考(简介,无实际内容) 原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线协议 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! 醇酒 2007.12.2 我的个人空间:http://www.icdev.com.cn/?474/ 第 3 页 共 27 页 5.1. SPI Bus Protocol 5.1. SPI总线协议 While the SD Card channel is based on command and data bit-streams, which are initiated by a start bit and terminated by a stop bit, the SPI channel is byte oriented. Every command or data block is built of eight bit bytes and is byte aligned (multiples of eight clocks) to the CS signal. 当 SD 卡通道是基于命令和数据位流模式上时,通常是开始于一个“起始位”和终止于一个“停止位”,这个 SPI通道是用字节作为单位的。CS信号上的每个命令或数据块都是 8bit的字节和字节队列(就是 8个时钟的倍数)。 Similar to the SD Bus protocol, the SPI messages are built from command, response and data-block tokens. All communication between host and cards is controlled by the host (master). The host starts every bus transaction by asserting the CS signal low. 相似 SD总线模式,这个 SPI信息是建立在命令、应答和数据块标记上的。所有的主控制器和 SD卡之间的通 讯都是受控于主控制器。而主控制器的每次总线处理都是从拉低 CS的信号电平开始的。 The response behavior in SPI Bus mode differs from the SD Bus mode in the following three ways: * The selected card always responds to the command. * An eight or 16-bit response structure is used. * When the card encounters a data retrieval problem, it will respond with an error response (which replaces the expected data block) rather than time-out as in the SD Bus mode. SPI总线协议和 SD总线协议的应答行为有下列三处的不同点: 1. 被选中的卡总是对命令做出应答; 2. 使用的应答结构是 8或 16位的; 3. 当这个卡碰到一个数据检索问题,它将用一个错误应答来回答(取代了原先期望的数据块)而不是 SD总 线协议模式下的超时。 In addition to the command response, every data block sent to the card during write operations will be responded with a special data response token. A data block may be as big as one card write block (WRITE_BL_LEN) and as small as a single byte(NOTE1). 除了命令的应答之外,每个数据块发送到 SD卡后,在写操作的期间将用一个特别的数据应答标记来应答。一 个数据块可以大到卡的写入块长度(WRITE_BL_LEN)或小到一个单字节的大小(注意 1)。 NOTE1: The default block length is as specified in the CSD (512 bytes). A set block length of less than 512 bytes will cause a write error. The only valid write set block length is 512 bytes. CMD16 is not mandatory if the default is accepted. 注意 1:缺省的块长度定义在 CSD寄存器内(512字节)。设定块的的长度小于 512字节将会导致写入错误。 唯一合法的块写入长度只能定为 512字节。若此缺省值可接受,则无需使用 CMD16命令,它不是必要的。 5.1.1. Mode Selection 5.1.1.模式选择 The SD Card wakes up in the SD Bus mode. It will enter SPI mode if the CS signal is asserted (negative) during the reception of the reset command (CMD0). If the card recognizes that the SD Bus mode is required it will not respond to the command and remain in the SD Bus mode. If SPI mode is required, the card will switch to SPI mode and respond with the SPI mode R1 response. SD卡启动时处在 SD总线模式下。它将在 CS信号有效(低电平)时接收一个复位命令(CMD0)来进入 SPI 总线模式。如果这个卡认为必须停留在 SD总线模式,那么它将不应答这个命令并继续保持在 SD总线模式。如果 可以转换到 SPI总线模式,则它会转换到 SPI总线模式并用 SPI模式的 R1应答来作回应。 The only way to return to the SD Bus mode is by power cycling the card. In SPI mode, the SD Card protocol state machine is not observed. All the SD Card commands supported in SPI mode are always available. 而唯一让卡返回 SD总线模式的办法是用电源周期(即电源关开一次)。在 SPI总线模式下,SD卡的保护状态 机将不会被遵守了。SD卡所有能支持的命令在 SPI模式下总是可以使用的。 The default command structure/protocol for SPI mode is that CRC checking is disabled. Since the card powers up in SD Bus mode, CMD0 must be followed by a valid CRC byte (even though the command is sent using the SPI structure). Once in SPI mode, CRCs are disabled by default. SPI总线模式下,默认的命令结构/协议 CRC检查是失效的。由于卡在电源开启时总是处于 SD总线模式,CMD0 命令必须跟随一个合法的 CRC字节(即使这个命令使用了 SPI结构来发送)。一旦进入 SPI总线模式,CRC就被默 认为失效的了。 原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线协议 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! CMD0 is a static command and always generates the same 7-bit CRC of 4Ah. Adding the “1,” end bit (bit 0) to the CRC creates a CRC byte of 95h. The following hexadecimal sequence can be used to send CMD0 in all situations for SPI mode, since the CRC byte (although required) is ignored once in SPI mode. The entire CMD0 sequence appears as 40 00 00 00 00 95 (hexadecimal). CMD0 是一个静态的命令,总是用 0A4h 来产生同一个 7 位的 CRC,附加一个“1”在最低位(bit0)来产生 了 CRC 检查字节 095h。随后的 CMD0 命令的十六进制数序列可以在 SPI 总线模式的任何情况下发送,而此后的 CRC字节(“尽管还是必须的”。译者注:原文的意思是指这个 CRC字节所占的位置还是不可省略掉)会在 SPI模 式里被忽略。这个完整的 CMD0命令是 40 00 00 00 00 95 (十六进制系列)。 5.1.2. Bus Transfer Protection 5.1.2.总线传送保护 Every SD Card token transferred on the bus is protected by CRC bits. In SPI mode, the SD Card offers a non protected mode which enables systems built with reliable data links to exclude the hardware or firmware required for implementing the CRC generation and verification functions. 在总线上传送的每个 SD卡标志都是用 CRC的校验位来保护的。在 SPI模式里,SD卡提供了一个可靠的非保 护模式的连接方式,它排除了用硬件或固件来产生 CRC作为校验功能的必要性。 In the non-protected mode the CRC bits of the command, response and data tokens are still required in the tokens however, they are defined as “don’t care” for the transmitters and ignored by the receivers. 在这个非保护模式的命令、应答、和数据标记中的 CRC特征位仍然是需要的,然而,它们的含意为:发送方 “无需关注”和由接收方忽略掉。 The SPI interface is initialized in the non-protected mode. The host can turn this option on and off using CRC_ON_OFF command (CMD59). 这个 SPI接口是初始化成非保护模式的,而主控制器可以通过使用CRC_ON_OFF命令(CMD59)来切换它的开、 关状态。(译者注:根据本人的实际使用情况来看,SPI传输非常可靠,没必要使用 CRC来自找麻烦。) The CRC7/CRC16 polynomials are identical to that used in SD Bus mode. Refer to this section in the SD Bus mode chapter. 此 CRC7/CRC16多项式是和 SD总线模式相同的。请参考 SD总线模式的这些章节描述。 5.1.3. Data Read 5.1.3. 数据的读取 SPI mode supports single block and multiple block read operations (SD Card CMD17 or CMD18). Upon reception of a valid read command the card will respond with a response token followed by a data token in the length defined in a previous SET_BLOCK_LENGTH (CMD16) command (see Figure 5-1). SPI 模式可支持单个块和多个块的读操作(SD 卡的 CMD17 或 CMD18)。在接收到一个合法的读取命令后, 这个卡将用一个应答标志来应答,随后的就是一个数据块,它的长度是先前定义在 SET_BLOCK_LENGTH (CMD16) 命令中的(请看图表 5-1)。 图表 5-1 单个数据块的读取操作 A valid data block is suffixed with a 16-bit CRC generated by the standard CCITT polynomial: 一个有效的数据块的尾缀是 16bit的 CRC,它是用符合 CCITT标准的多项式产生的: X^16 + X^12 + X^5 + 1. 醇酒 2007.12.2 我的个人空间:http://www.icdev.com.cn/?474/ 第 4 页 共 27 页 原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线协议 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! The maximum block length is 512 bytes as defined by READ_BL_LEN (CSD parameter). Block lengths can be any number between 1 and READ_BL_LEN. 这个最大的块长度是 512字节,由 READ_BL_LEN (CSD参数)定义的。块的长度可以是 1到 READ_BL_LEN 之间的任何一个数值。 The start address can be any byte address in the valid address range of the card. Every block, however, must be contained in a single physical card sector. 这个开始地址可以是包含在卡的合法地址范围内的任何字节地址。但是,每个块必须是包含在卡的一个单独 物理扇区内。 In case of data retrieval error, the card will not transmit any data. Instead, a special data error token will be sent to the host. Figure 5-2 shows a data read operation, which terminated with an error token rather than a data block. 在数据接收错误时(译者注:这里应该是指 SD卡接收到的读取命令中包含了错误的参数,例如“块长度”或 “地址”参数使用了 SD 卡规定之外的格式),这个卡将不传送任何数据。替代的将是一个 报告 软件系统测试报告下载sgs报告如何下载关于路面塌陷情况报告535n,sgs报告怎么下载竣工报告下载 数据错误的标记被 发送到主控制器。图表 5-2 显示了一个数据的读操作,结果由于一个错误标记而终止,而不是期待的一个数据块。 图表 5-2. 读取操作 - 数据错误 In the case of a Multiple Block Read operation, every transferred block has a 16-bit CRC suffix. The Stop Transmission command (CMD12) will actually stop the data transfer operation (the same as in SD Bus mode). 在多块数据的读取操作情况下,每个被传送的块都有一个 16bit的 CRC后缀。而停止发送命令(CMD12)将 会终止这个数据传送操作(和 SD总线模式是相同的)。 图表 5-3. 多个块的读取操作 5.1.4. Data Write 5.1.4. 数据写入 In SPI mode, the SD Card supports single block or multiple block write operations. Upon reception of a valid write command (SD Card CMD24 or CMD25), the card will respond with a response token and will wait for a data block to be sent from the host. CRC suffix and start address restrictions are identical to the read operation (see Figure 5-4). The only valid block length, however, is 512 bytes. Setting a smaller block length will cause a write error on the next write command. 在 SPI 模式下,SD 卡支持单块的或多块的写操作。在接收到一个合法的写命令时(SD 卡命令 CMD24 或 CMD25),SD 卡将响应一个应答标记和等待主控制器发送这个数据块。CRC 后缀和起始地址的限制和读操作是一 样的(参看图表 5-4)。唯一合法的块长度是 512字节。如果设置了一个小于此值的块长度,将会导致下一条写入命 令产生错误。 醇酒 2007.12.2 我的个人空间:http://www.icdev.com.cn/?474/ 第 5 页 共 27 页 原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线协议 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! 图表 5-4. 单个块的写入操作 Every data block has a prefix or ‘start block’ token (one byte). After a data block is received the card will respond with a data-response token, and if the data block is received with no errors, it will be programmed. As long as the card is busy programming, a continuous stream of busy tokens will be sent to the host (effectively holding the dataOut line low). 每个数据块都有一个前缀或“开始快”标记(一个字节)。如果在一个数据块的接收被确认无误后,SD 卡将 用一个数据应答来回应,然后它将被烧录(编程)。卡在烧录(编程)期间是长时间处于忙状态的,一个持续不断 的忙标记将被发送到主控制器(即始终保持 DATAOUT信号线为低电平)。 Once the programming operation is completed, the host must check the results of the programming using the SEND_STATUS command (CMD13). Some errors (e.g., address out of range, write protect violation, etc.) are detected during programming only. The only validation check performed on the data block and communicated to the host via the data-response token is CRC and general Write Error indication. 一旦这个烧录(编程)操作完成,主控制器必须使用 SEND_STATUS 命令(CMD13)来检查这次编程烧录的结 果。一些错误(例如:地址超出范围、违反写保护等等)的检查只会在烧录(编程)期间才能进行。唯一在此数据 块和主控制器通讯上执行的检查效验,只能是通过数据应答标记的 CRC和产生写入错误的指示标记。 In Multiple Block write operation the stop transmission will be done by sending 'Stop Tran' token instead of 'Start Block' token at the beginning of the next block. In case of Write Error indication (on the data response) the host shall use SEND_NUM_WR_BLOCKS (ACMD22) in order to get the number of well written write blocks. The data token's description is given in Section 5.2.4. 如果需要在多个块的写入操作中停止传送过程,则是在开始传送下一块的时候,通过发送“停止传送”标记 来代替“起始块”标记。如果发生写错误指示(在此数据应答上),主控制器可以使用 SEND_NUM_WR_BLOCKS 命令(ACMD22)来获得已经写入的块的数量。此数据标记的描述在章节 5.2.4中。 图表 5-5. 多个块的写入操作 Resetting the CS signal while the card is busy does not terminate the programming process. The card releases the dataOut line (tristate) and continue to program. If the card is reselected before the programming is done, the dataOut line will be forced back to low and all commands will be rejected. 在卡处于“忙”状态的时候,重新设置 CS信号并不能终止烧录(编程)的处理过程。卡将会释放 DATAOUT 信号线(变成三态)和继续进行烧录(编程)的处理。如果在烧录(编程)完成之前重新选中该卡,DATAOUT信 号线将会被强制置为低电平,并且拒绝所有的命令。 Resetting a card (using CMD0) will terminate any pending or active programming operation. This may destroy the data formats on the card. It is the host's responsibility to prevent it. 而复位一个卡(使用 CMD0 命令)将终止任何等待执行或正在进行的编程烧录操作动作。这样会破坏卡上的 数据格式。主控制器必须负责避免出现这种状况(译者注:这种状况可能会导致你要重新格式化该卡。)。 醇酒 2007.12.2 我的个人空间:http://www.icdev.com.cn/?474/ 第 6 页 共 27 页 原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线协议 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! 5.1.5. Erase and Write Protect Management 5.1.5. 擦除和写保护处理 The erase and write protect management procedures in the SPI mode are identical to the SD Bus mode. While the card is erasing or changing the write protection bits of the predefined sector list it will be in a busy state and will hold the dataOut line low. Figure 5-6 illustrates a “no data” bus transaction with and without busy signaling. 在 SPI模式下,擦除和写保护管理程序和 SD模式下是一样的。当该卡进行擦除、或对指定的扇区目录的写保 护位进行修改时,它将处于忙状态并保持 DATAOUT信号线为低电平。图表 5-6举例说明了用外部的忙信号来处理 一个“无数据”总线的情况。 图表 5-6. “无数据”操作 5.1.6. Read CID/CSD Registers 5.1.6. 读取 CID/CSD 寄存器 Unlike the SD Bus protocol (where the register contents are sent as a command response), reading the contents of the CSD and CID registers in SPI mode is a simple read-block transaction. The card will respond with a standard response token followed by a data block of 16 bytes suffixed with a 16-bit CRC. 与 SD总线协议不同(那些寄存器内容是包含在发送的命令应答内),在 SPI总线模式里是通过一个简单的“读 块”处理来获取 CSD和 CID寄存器的内容。这个卡将用一个标准的响应标记、和跟随其后的 16字节的数据块加上 它 16bit CRC的后缀来响应。 The data time out for the CSD command cannot be set to the card TAAC since this value is stored in the CSD. Therefore, the standard response time-out value (Ncr) is used for read latency of the CSD register. 由于此数值储被储存在 CSD 中,不能用 CSD 命令中的 TimeOut 数值来设置 TAAC。因此,这个标准的响应 TimeOut值(Ncr)是用来表示 CSD寄存器的读取等待时间。 5.1.7. Reset Sequence 5.1.7. 复位顺序 The SD Card requires a defined reset sequence. After power on reset or CMD0 (software reset), the card enters an idle state. At this state, the only legal host commands are CMD1 (SEND_OP_COND), ACMD41 (SD_SEND_OP_COND), CMD59 (CRC_ON_OFF) and CMD58 (READ_OCR). SD卡有设定好的复位顺序。在上电复位或用软复位(用 CMD0命令)之后,这个卡将进入静止状态。在这个 状态里,只能接收 4 条合法的主控命令:CMD1 (SEND_OP_COND), ACMD41 (SD_SEND_OP_COND), CMD59 (CRC_ON_OFF) 和 CMD58 (READ_OCR)。 The host must poll the card (by repeatedly sending CMD1) until the ‘in-idle-state’ bit in the card response indicates (by being set to 0) that the card completed its initialization processes and is ready for the next command. 主控制器必须连续检测这个卡(通过不断地发送 CMD1),直到 in-idle-state 位在卡的应答中指示(即被设置 成 0)出该卡已经完成了初始化处理,并且可以接收下一条命令。 In SPI mode, however, CMD1 has no operands and does not return the contents of the OCR register. Instead, the host can use CMD58 (SPI Mode Only) to read the OCR register. It is the responsibility of the host to refrain from accessing cards that do not support its voltage range. 在 SPI模式里,无论什么情况下 CMD1都没有操作数,和它不会返回 OCR寄存器的内容。作为一个替代品, 命令 CMD58(仅仅为 SPI模式命令)可以读取 OCR寄存器。它的职责是防止主控制器去访问一个不在规定电压支 持范围内的卡。 醇酒 2007.12.2 我的个人空间:http://www.icdev.com.cn/?474/ 第 7 页 共 27 页 原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线协议 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! 醇酒 2007.12.2 我的个人空间:http://www.icdev.com.cn/?474/ 第 8 页 共 27 页 The use of CMD58 is not restricted to the initialization phase only, but can be issued at any time. The host must poll the card (by repeatedly sending CMD1) until the ‘in-idle-state’ bit in the card response indicates (by being set to 0) that the card has completed its initialization process and is ready for the next command. 而这个 CMD58也并不是只限制在初始化阶段使用,它可以在任何时候使用。只是主控制器必须连续检测这个 卡(通过不断地发送 CMD1),直到 in-idle-state 位在卡的应答中指示(即被设置成 0)出该卡已经完成了初始化处 理并且可以接收下一条命令(译者注:这里的描述很含糊,意思应该是说在 SPI 协议模式下,CMD58 命令可以替 代 SD协议模式下的 CMD1命令来获取 OCR寄存器的内容,但是必须要等 SD卡的初始化处理过程完毕,而 SD卡 的初始化处理过程是否已经完毕还是要用 CMD1来查询)。 5.1.8. Clock Control 5.1.8. 时钟控制 The SPI bus clock signal can be used by the SPI host to set the cards to energy-saving mode or to control the data flow (to avoid under-run or over-run conditions) on the bus. The host is allowed to change the clock frequency or shut it down. SPI 总线时钟可以通过 SPI 主控来设置这个卡到“省电模式”,或者用来控制数据在总线上的流动率(用来避 免“使用不足”或“过度占用”情况)。主控可以修改时钟频率或者关掉它(译者注:应该是指关闭 SPI 总线和相 关控制电路)。 There are a few restrictions the SPI host must follow: 这里对 SPI主控有几条必须遵守的限制情况: * The bus frequency can be changed at any time (under the restrictions of maximum data transfer frequency, defined by the SD Cards). * 总线频率可以在任何时间修改(不允许超过数据的最大传送频率,它在 SD卡中是有定义的)。 * It is an obvious requirement that the clock must be running for the SD Card to output data or response tokens. After the last SPI bus transaction, the host is required to provide 8 (eight) clock cycles for the card to complete the operation before shutting down the clock. Throughout this 8-clock period, the state of the CS signal is irrelevant. It can be asserted or de-asserted. Following is a list of the various SPI bus transactions: * 显而易见,SD卡要依靠这个时钟的运作来输出数据或应答标记。在当前的 SPI总线传送结束之后,和在停 止时钟运作之前,主控必须提供 8 个时钟周期给卡来完成这个操作。在这整个的 8 个时钟期间,CS 信号的状态是 无所谓的,它可以有效(低电平)也可以无效(高电平)。下面是 SPI总线的各种装况列表: - A command/response sequence. Eight clocks after the card response end bit. The CS signal can be asserted or de-asserted during these 8 clocks. 一个命令/应答顺序。在卡的应答的结束 bit之后跟随 8个时钟。CS信号在此 8个时钟期间的状态是无所谓的。 - A read data transaction. Eight clocks after the end bit of the last data block. 读数据的处理。在数据块最后结束位之后跟随 8个时钟。 - A write data transaction. Eight clocks after the CRC status token. 写数据的处理。在 CRC的状态标记之后跟随 8个时钟。 * The host is allowed to shut down the clock of a “busy” card. The SD Card will complete the programming operation regardless of the host clock. However, the host must provide a clock edge for the card to turn off its busy signal. Without a clock edge, the SD Card (unless previously disconnected by de-asserting the CS signal) will force the dataOut line down, permanently. 主控制器可以在卡的“忙”状态时关闭时钟信号。SD卡将去完成这个烧录(编程)操作而不理睬主控制器的 时钟信号。然而,主控制器必须要提供一个时钟沿给 SD 卡来关掉它的“忙”信号。没有这个时钟沿,SD 卡将永 久性的将 DATAOUT信号线强制为低(除非先前通过将 CS信号声明为无效来断开连接)。 5.1.9. Error Conditions 5.1.9. 错误条件 The following sections provide valuable information on error conditions. 以下章节提供了关于错误情况方面的重要信息。 5.1.9.1. CRC and Illegal Commands 5.1.9.1. CRC和无效指令 Unlike the SD Card protocol, in SPI mode the card will always respond to a command. The response indicates acceptance or rejection of the command. A command may be rejected in any one of the following cases: 不同于 SD协议模式,在 SPI模式里卡总是对命令做出应答。这个应答指出了对该命令进行接受或拒绝。命令 被拒绝是属于下列的情况之一: 原文:SanDisk Secure Digital Card - Product Manual Version 2.2 (Document No. 80-13-00169 September 2004) 第 5章 SPI总线协议 译者:醇酒。请尊重我的劳动,勿抄袭和修改本文中的内容,若文中翻译有不妥之处,请 Email:chunjiu○a 263.net处指正,不胜感激! 醇酒 2007.12.2 我的个人空间:http://www.icdev.com.cn/?474/
本文档为【SPI总线协议】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_496223
暂无简介~
格式:pdf
大小:1MB
软件:PDF阅读器
页数:27
分类:生产制造
上传时间:2011-04-11
浏览量:69