阅读:5187回复:4
使用USB CDC abstract control model实现虚串口
使用此模式描述符,PC枚举上设备并出现了一个虚串口号,并且可以使用超级终端向板子这边发送字符,但是板子这边向PC发送字符,PC只通过IN TOKEN接收一个字符后,再也不发IN TOKEN了,请教各位这是什么原因呢,谢谢
|
|
最新喜欢:julyja... |
沙发#
发布于:2008-03-06 23:27
这是我使用的描述符,是不是使用超级终端不能直接从板子这边向PC发字符呢?
static T_U8 deviceDescrCDC[] = { /* USB device descriptor */ 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */ DEVICE_DESC_TYPE, /* descriptor type */ 0x10, 0x01, /* USB version supported */ 0x02, /* device class: CDC */ 0, /* subclass */ 0, /* protocol */ EP0_MAX_PAK_SIZE, /* max packet size */ 0x71, 0x04, /* 2 bytes */ 0x77, 0x07, /* 2 bytes: shared PID for CDC-ACM devices */ 0x00, 0x01, /* 2 bytes */ 0, /* manufacturer string index */ 0, /* product string index */ 0, /* serial number string index */ 1, /* number of configurations */ }; static T_U8 configDescrCDC[] = { /* USB configuration descriptor */ 9, /* sizeof(usbDescrConfig): length of descriptor in bytes */ 2, /* descriptor type */ 67, 0, /* total length of data returned (including inlined descriptors) */ 2, /* number of interfaces in this configuration */ 1, /* index of this configuration */ 0, /* configuration name string index */ 0x80, 50, /* max USB current in 2mA units */ /* interface descriptor follows inline: */ 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ 4, /* descriptor type */ 0, /* index of this interface */ 0, /* alternate setting for this interface */ 1, /* endpoints excl 0: number of endpoint descriptors to follow */ 0x02, /* CDC class */ 2, /* Abstract (Modem) */ //1, /* AT-Commands */ 0, /* No protocol code */ 0, /* string index for interface */ /* CDC Class-Specific descriptor */ 5, /* sizeof(usbDescrCDC_HeaderFn): length of descriptor in bytes */ 0x24, /* descriptor type */ 0, /* header functional descriptor */ 0x10, 0x01, 5, /* Size of this descriptor */ 0x24, /* CS_INTERFACE type */ 1, /* Call management descriptor */ 0x01, /* Call management is handled by the device */ 0x01, /* Data interface is 0x01 */ 4, /* Size of this descriptor */ 0x24, /* CS_INTERFACE type */ 2, /* Abstract control management functional descriptor */ 7, /* Every request/notification except NetworkConnection supported */ 5, /* Size of this descriptor */ 0x24, /* CS_INTERFACE type */ 6, /* union functional descriptor */ 0x00, /* Master interface is 0x00 (Communication class interface) */ 0x01, /* First slave interface is 0x01 */ /* Endpoint Descriptor */ 7, /* sizeof(usbDescrEndpoint) */ 5, /* descriptor type = endpoint */ 0x81, /* IN endpoint number 1 */ 0x03, /* attrib: Interrupt endpoint */ 64, 0, /* maximum packet size */ 10, /* in ms */ /* Interface Descriptor */ 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ 4, /* descriptor type */ 1, /* index of this interface */ 0, /* alternate setting for this interface */ 2, /* endpoints excl 0: number of endpoint descriptors to follow */ 0x0A, /* Data Interface Class Codes */ 0, 0, /* Data Interface Class Protocol Codes */ 0, /* string index for interface */ /* Endpoint Descriptor */ 7, /* sizeof(usbDescrEndpoint) */ 5, /* descriptor type = endpoint */ 0x03, /* OUT endpoint number 3 */ 0x02, /* attrib: Bulk endpoint */ EP3_BUF_MAX_LEN, 0, /* maximum packet size */ 0, /* in ms */ /* Endpoint Descriptor */ 7, /* sizeof(usbDescrEndpoint) */ 5, /* descriptor type = endpoint */ 0x82, /* IN endpoint number 2 */ 0x02, /* attrib: Bulk endpoint */ EP2_BUF_MAX_LEN, 0, /* maximum packet size */ 0, /* in ms */ }; |
|
板凳#
发布于:2008-06-13 10:25
哥们 ,你的问题解决没有,我现在也遇到了同样的问题,就是发送数据不稳定 ,有时候能收到,大部分收不到,我用的是isp1362
|
|
地板#
发布于:2008-06-27 10:40
这个我前段试过,跟操作串口的方式有关,我用串口调试助手,只能接收到一次数据,用sscom32就可以正常通讯,这个可能跟CDC类提供的功能有关,虚拟串口驱动没包含全部rs-232标准的功能.我现在也为这个头痛,实在不行,可能只能遵循多串口协议来写固件和驱动了。
|
|
地下室#
发布于:2008-11-04 18:56
能否将CDC ACM文档共享一下?
|
|