分享

定制CP2102的windows驱动程序

 筱肆 2014-04-28

分类:

      CP2102 Silicon公司的USBUART的芯片,UART端支持所有modem接口信号,波特率最高可以达到1Mbits,内部有576Byte 的接收缓冲区和640Byte的发送缓冲区。

 

   硬件电路方面,所需要元件少之又少,仅需两个104的瓷片电容和一个复位引脚的上拉电阻即可。

       Silicon公司为它的产品写了非常完整的说明文档及驱动程序。如果要测试硬件是否有问题,最好使用Silicon公司提供的虚拟串口驱动程序(VCP),插入后,会提示找到新设备,安装VCP驱动如果成功的话,会在设备管理器界面下发现新的串口,此时可以当然普通串口用。

       Silicon公司还提供了另一种驱动程序的接口,USBXpress开发包,这个驱动不会在PC上虚拟一个串口,个性化更好,用起来更方便。懒得翻译了,复制一份英文说明:

The Silicon Laboratories USBXpress? Development Kit provides a complete host and device software solution for interfacing Silicon Laboratories C8051F32x, C8051F34x, and CP210x devices to the Universal Serial Bus (USB).No USB protocol or host device driver expertise is required. Instead, a simple, high-level Application Program.Interface (API) for both the host software and device firmware is used to provide complete USB connectivity.

USBXpress 开发包包含了Windows设备驱动,Windows设备驱动的安装软件,以动态链接库形式提供的主机接口函数库(hostAPI)。

 

The host API is provided in the form of a Windows Dynamic Link Library (DLL). The host interface DLL communicates with the USB device via the provided device driver and the operating system's USB stack. The following is a list of the host API functions available:

SI_GetNumDevices() - Returns the number of devices connected

SI_GetProductString() - Returns a descriptor for a device

SI_Open() - Opens a device and returns a handle

SI_Close() - Cancels pending IO and closes a device

SI_Read() - Reads a block of data from a device

SI_Write() - Writes a block of data to a device

SI_FlushBuffers() - Flushes the TX and RX buffers for a device

SI_SetTimeouts() - Sets read and write block timeouts

SI_GetTimeouts () - Gets read and write block timeouts

SI_CheckRXQueue() - Returns the number of bytes in a device's RX queue

SI_SetBaudRate() - Sets the specified CP210x Baud Rate

SI_SetBaudDivisor() - Sets the specified CP210x Baud Divisor Value

SI_SetLineControl() - Sets the CP210x device Line Control

SI_SetFlowControl() - Sets the CP210x device Flow Control

SI_GetModemStatus() - Gets the CP210x device Modem Status

SI_SetBreak() - Sets the Break State for CP210x device.

SI_ReadLatch() - Gets the port latch value from a CP2103 device

SI_WriteLatch() - Sets the port latch value to a CP2103 device

SI_GetPartNumber() - Gets the CP210x device part number

SI_DeviceIOControl() - Allows sending low-level commands to the device driver

 

    如果要使用这些函数,首先得让设备安装了这个驱动,Silicon公司提供了另一个软件用来生成特定设备的驱动程序:CustomUSBDriverWizard.exe,并有个被命名为“an220”文档说明怎么使用。

 

    这些软件和文档均可以该公司网站上下载到。如下图所示,你就可以知道他可以生成怎么样的驱动了 ,从上至下分别是:使用虚拟串口的驱动,使用USBXpress驱动;定制可执行的安装程序,仅生成inf文件。

   

    按提示操作,就可以生成特定VIDPID及其他信息的设备驱动,如果选择了定制可执行的安装程序,会生成一个.exe文件,使用时直接运行它就行了。如果选择VCP驱动,则生成两个inf文件,一个是为总线使用的,另一个是为虚拟串口使用的,具体细节我也不懂,呵呵。

 

       USBXpress开发包还提供了另一个接口函数库CP210xManufacturing.lib,这个库可用来更改存于CP2102内部EEPROM中设备的信息。一般情况下先安装一个VCP驱动,再用使用该库文件的软件可直接修改ID信息,修改后,设备将自动被移除,并提示发现新硬件。

 

 

阅读(3966) | 评论(0) | 转发(0) |
相关热门文章

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多