cdc类虚拟串口固件设计_毕业论文.doc
约40页DOC格式手机打开展开
cdc类虚拟串口固件设计_毕业论文,摘 要在接口技术高速发展的今天,串口即将成为历史。usb等接口将逐步取代串口成为新一代最常用的接口。然而,由于之前串口较为普及,针对串口的应用程序也非常多,而且有些功能还非常强大,如何能够最大限度地减少接口更新对应用程序的影响,成为了当今接口技术的一个新课题。本文就基于usb的cdc类,在带有usb口的c8051f34...
内容介绍
此文档由会员 莎士比亚 发布
摘 要
在接口技术高速发展的今天,串口即将成为历史。USB等接口将逐步取代串口成为新一代最常用的接口。然而,由于之前串口较为普及,针对串口的应用程序也非常多,而且有些功能还非常强大,如何能够最大限度地减少接口更新对应用程序的影响,成为了当今接口技术的一个新课题。
本文就基于USB的CDC类,在带有USB口的C8051F340单片机上,以开发USB虚拟串口固件为目标,通过标准请求、设备管理、数据传输等模块的设计与论证,并结合固件开发的实际,完成了USB到虚拟串口的转换的设计。
本文的核心是建立ACM模型,即抽象控制模型。根据这个模型,对CDC类下的通信接口类和数据接口类进行设计开发,并着重对通信接口和数据接口的各个端点进行设计论证。在此基础上,实现对USB设备的枚举,控制以及数据传输等功能,从而为实现USB到虚拟串口的转换提供了保证。
关键词:USB;虚拟串口;CDC;抽象控制模型
Abstract
Nowadays, as the interface technology develops in a high speed, the serial port is going to be history. Interface such as USB will replace serial port gradually and be the most common one in a new generation. However, since the widely spreading of serial port in past with great deal of development programs of serial port, and some functions are powerful, it has been a new problem that how to reduce the influence caused by interface update to application program to the maxima limit.
The paper focuses on how to convert Universal Serial Bus (USB) to a serial port in the C8051F340 microcontroller with USB port. In order to realize the function of virtual serial port, we combine with the actual firmware, design and demonstrate the standard request, device management and data transmission module.
The core of this paper is to establish an ACM , that is the Abstract Control Model. Based on this model, the data communication interface class and interface class which under the CDC are designed and developed. Focusing on the various endpoints which are included in the communication interface and data interface it has a demonstration. On this basis, it have realized the enumeration and control on the USB device, also, data transfer capabilities. Thus, it guarantees the alteration from USB to virtual serial port.
Keywords: USB; virtual serial port; Abstract Control Model
目 录
1 引言 1
1.1 课题背景 1
1.2 课题要求 1
1.3 课题意义 2
2 相关技术及开发工具 3
2.1 CDC类简述 3
2.2 C8051F340单片机简介 3
2.3 开发环境简介 4
3 总体设计 6
3.1 应用软件的模块设计 7
3.2 应用软件的功能设计 7
4 详细设计 10
4.1 标准请求 10
4.1.1 设备描述符 10
4.1.2 配置描述符 11
4.1.3 接口描述符 12
4.1.4 端点描述符 13
4.1.5 字符串描述符 14
4.1.6 描述符设计要求 14
4.1.7 标准命令 15
4.2 类请求的实现 17
4.2.1 SEND_ENCAPSULATED_COMMAND请求 17
4.2.2 GET_ENCAPSULATED_RESPONSE请求 17
4.2.3 GET_LINE_CODING 请求 17
4.2.4 SET_LINE_CODING 请求 18
4.2.5 SET_CONTROL_LINE_STATE请求 19
4.3 数据传输的实现 19
4.3.1 令牌包 19
4.3.2 数据包 20
4.3.3 握手包 20
4.3.4 数据传输 20
4.4 INF文件的创建 21
4.4.2 INF文件的规范 23
4.4.3 INF文件的内容 23
5 联机调试 26
5.1 调试设置 26
5.2 下载调试 26
6 固件测试及结论 30
6.1 串口调试工具设置 31
6.2 数据传输测试 31
6.3 结论 31
参考文献 33
致 谢 35
在接口技术高速发展的今天,串口即将成为历史。USB等接口将逐步取代串口成为新一代最常用的接口。然而,由于之前串口较为普及,针对串口的应用程序也非常多,而且有些功能还非常强大,如何能够最大限度地减少接口更新对应用程序的影响,成为了当今接口技术的一个新课题。
本文就基于USB的CDC类,在带有USB口的C8051F340单片机上,以开发USB虚拟串口固件为目标,通过标准请求、设备管理、数据传输等模块的设计与论证,并结合固件开发的实际,完成了USB到虚拟串口的转换的设计。
本文的核心是建立ACM模型,即抽象控制模型。根据这个模型,对CDC类下的通信接口类和数据接口类进行设计开发,并着重对通信接口和数据接口的各个端点进行设计论证。在此基础上,实现对USB设备的枚举,控制以及数据传输等功能,从而为实现USB到虚拟串口的转换提供了保证。
关键词:USB;虚拟串口;CDC;抽象控制模型
Abstract
Nowadays, as the interface technology develops in a high speed, the serial port is going to be history. Interface such as USB will replace serial port gradually and be the most common one in a new generation. However, since the widely spreading of serial port in past with great deal of development programs of serial port, and some functions are powerful, it has been a new problem that how to reduce the influence caused by interface update to application program to the maxima limit.
The paper focuses on how to convert Universal Serial Bus (USB) to a serial port in the C8051F340 microcontroller with USB port. In order to realize the function of virtual serial port, we combine with the actual firmware, design and demonstrate the standard request, device management and data transmission module.
The core of this paper is to establish an ACM , that is the Abstract Control Model. Based on this model, the data communication interface class and interface class which under the CDC are designed and developed. Focusing on the various endpoints which are included in the communication interface and data interface it has a demonstration. On this basis, it have realized the enumeration and control on the USB device, also, data transfer capabilities. Thus, it guarantees the alteration from USB to virtual serial port.
Keywords: USB; virtual serial port; Abstract Control Model
目 录
1 引言 1
1.1 课题背景 1
1.2 课题要求 1
1.3 课题意义 2
2 相关技术及开发工具 3
2.1 CDC类简述 3
2.2 C8051F340单片机简介 3
2.3 开发环境简介 4
3 总体设计 6
3.1 应用软件的模块设计 7
3.2 应用软件的功能设计 7
4 详细设计 10
4.1 标准请求 10
4.1.1 设备描述符 10
4.1.2 配置描述符 11
4.1.3 接口描述符 12
4.1.4 端点描述符 13
4.1.5 字符串描述符 14
4.1.6 描述符设计要求 14
4.1.7 标准命令 15
4.2 类请求的实现 17
4.2.1 SEND_ENCAPSULATED_COMMAND请求 17
4.2.2 GET_ENCAPSULATED_RESPONSE请求 17
4.2.3 GET_LINE_CODING 请求 17
4.2.4 SET_LINE_CODING 请求 18
4.2.5 SET_CONTROL_LINE_STATE请求 19
4.3 数据传输的实现 19
4.3.1 令牌包 19
4.3.2 数据包 20
4.3.3 握手包 20
4.3.4 数据传输 20
4.4 INF文件的创建 21
4.4.2 INF文件的规范 23
4.4.3 INF文件的内容 23
5 联机调试 26
5.1 调试设置 26
5.2 下载调试 26
6 固件测试及结论 30
6.1 串口调试工具设置 31
6.2 数据传输测试 31
6.3 结论 31
参考文献 33
致 谢 35