计算机usb论文.doc
计算机usb论文,摘 要usb(universal serial bus,通用串行总线)是外围设备与计算机进行连接的新型接口总线。自从问世以来,凭借其高速度和高通用性迅速成为个人计算机与外未设备相连的标准接口,现在市场上售出的所有pc机都百分之百的支持usb接口,而且很多外设只推出usb版本。可以预见,usb的应用回越来越广泛,其传输速...
内容介绍
此文档由会员 dxh2012 发布摘 要
USB(Universal Serial Bus,通用串行总线)是外围设备与计算机进行连接的新型接口总线。自从问世以来,凭借其高速度和高通用性迅速成为个人计算机与外未设备相连的标准接口,现在市场上售出的所有PC机都百分之百的支持USB接口,而且很多外设只推出USB版本。可以预见,USB的应用回越来越广泛,其传输速率和通用性也会越来越高。
固件程序的设计是USB设备开发过程中非常重要的一个环节,它直接影响到USB设备的传输速度。本文在深入分析USB2.0协议、海量存储类规范和SCSI指令集的基础上,提出了一种专门针对U盘应用的固件设计方法,重点论述了固件实现过程中的几个关键技术,证明USB2.0接口控制芯片的固件设计达到了预期目标。
由于USB2.0协议的主/从式模式,固件的整个流程基于中断模式实现。固件程序主要包括三部分:1)初始化单片机和所有外围电路;2)中断服务程序,完成各个模块产生的中断响应;3)任务处理子模块,供中断服务程序调用,完成具体的USB设备操作。在实现的过程中,主处理程序完成系统的初始化并轮询中断,固件负责协议的解析和处理,不干预数据的传输,这样,保证了快速的数据传输和较好的软件结构。
通过对调试过程和性能测试结果,我们可以看出,固件能够控制硬件电路快速的完成各种操作,达到了预期的设计目标。
关键词:通用串行总线;固件;闪存;块传
ABSTRACT
Universal Serial Bus(USB)is a new type of serial bus which connects peripherals to computer.Since its advent,USB has rapidly become a standard interface between personal computer(PCs)and peripherals for its high transfer speed and applicability.All PCs on market today support USB interface with no exception,while many peripherals are found with only USB interfaces.It is predictable that USb will be more and more popular with its transfer speed and applicability being increasesd.
Firmware is very important in a USB device project, which affects the transfer speed of USB directly.This dissertation puts forward a new solution on the firmware's design of flash memory disk based on studying USB2.0 protocol, mass storage class and Small Computer System Interface (SCSI) command sets thoroughly. This dissertation describes the key technologies during the realization of firmware being designed.which testifies that the firmware of USB2.0 Interface Controller ASIC achieves the desired sights.
In accordance with the Master-Slave architecture in USB 2.0 protocol, the workflow of the firmware is implemented based on interrupt pattern. The firmware program includes three sections: initialization microcontroller and all the peripheral circuits; interrupt service routine, which triggers interrupts and executes the interrupt;task module, which is called by the ISR.During the procedure of realization, main programme implements the initialization of system and waits for the occurrence of interrupt, the ISR calls the task module to execute the operation. The firmware analyzes the protocols and does not disturb the transfer of data. Thus, this procedure can not only guarantee the high transfer speed and good software structure but also simplify the design and test.
In accordance with the Master-Slave architecture in USB 2.0 protocol, the workflow of the firmware is implemented based on interrupt pattern. The firmware program includes three sections: initialization microcontroller and all the peripheral circuits; interrupt service routine, which triggers interrupts and executes the interrupt;task module, which is called by the ISR.During the procedure of realization, main programme implements the initialization of system and waits for the occurrence of interrupt.The firmware analyzes the protocols and does not disturb the transfer of data. Thus, this procedure can not only guarantee the high transfer speed and good software structure.
Key words:Universal Serial Bus;firmware;flash memory;Bulk-Only transport protocol
目 录
1 绪论 1
1.1 USB技术发展现状与研究意义 1
1.2 工作目标 1
2 协议分析 2
2.1 USB2.0协议分析 2
2.1.1 USB的系统结构 2
2.1.2 USB数据基本类型 4
2.1.3 USB数据传输 8
2.1.4 USB设备 8
2.2海量存储类规范介绍 10
2.2.1 Bulk-Only传输流程 10
2.2.2 Bulk-Only的几种传输情形 13
2.3 SCSI命令简介 14
3 内置USB2.0控制器的单片机AT89C5131 17
3.1 AT89C5131特点概述 17
3.2 USB控制器的结构与配置 17
4 USB2.0接口控制芯片固件的设计与实现 19
4.1固件设计方案及工作流程 19
4.1.1固件的设计思想 19
4.1.2固件的工作流程 19
4.1.3固件的总体划分 21
4.1.4 USB2.0接口控制芯片固件的实现 22
4.2 固件主处理层的实现过程 22
4.2.1系统上电及初始化处理 22
4.2.2 USB标准请求实现过程 23
5.2.3 描述符表 26
4.3 BULK-ONLY传输处理层实现过程 27
4.4 SCSI指令处理层实现过程 28
4.4.1 Read(10)命令处理过程 28
5.4.2 Write(10)命令处理过程 29
4.4.3 其他命令的处理 30
4.4.3 其他命令的处理 30
4.5闪存处理层的实现过程 30
4.5.1 FLASH的擦除操作 31
4.5.2 FLASH的写入操作 31
4.5.3 FLASH的读取操作 32
5 U盘系统的虚拟测试 34
5.1 PROTEUS ISIS简介 34
5.2 KEIL UVISION3简介 34
5.3 系统虚拟测试步骤 35
5.3.1 生成机器码 35
5.3.2 虚拟电路图的绘制 35
5.3.3 导入程序模拟运行 36
6 U盘系统实物测试 39
结束语 41
致谢 42
参考文献 43