阅读:1621回复:1
USB配置问题
我的USB设备准备用于数据采集的通信,准备采用两个端点,一个用于数据采集的命令,一个用于数据的返回,但是在使用winDriver的时候,发现了设备,也能生成.INF文件,但再往下走的时候(按OK),windriver 就无响应了,能看出有什么问题吗?
下面是我的配置: const unsigned char CFG_DESC[] = {CFG_LENGTH, /*length of this desc. */ CONFIGURATION, /*CONFIGURATION descriptor*/ 0x22,0x00, /*total length returned */ 0x01, /*number of interfaces */ 0x01, /*number of this config */ CFG_STR_OFS, /*index of config. string */ ATTRIBUTES, /*attr.: bus powered */ 50, /*max power (100 mA) */ INT_LENGTH, /*length of this desc. */ INTERFACE, /*INTERFACE descriptor */ 0x00, /*interface number */ 0x00, /*alternate setting */ 0x02, /*# of (non 0) endpoints */ 0x00, /*interface class */ NOSUBCLASS, /*interface subclass */ 0x00, /*interface protocol */ INT_STR_OFS, /*index of intf. string */ HID_LENGTH, /*length of this desc. */ 00, /*HID descriptor */ 0x00,0x00, /*HID spec rev level (BCD)*/ 0x00, /*target country */ 0, /*# HID class desc follow.*/ 0, /*report descr. type */ 0,0x00, /*report descr. length */ /*The WDM driver for this board references the endpoints by 'pipe' */ /*number: 0, 1, 2 et al in order below: */ /*Pipe 0 (endpoint 5) */ END_LENGTH, /*length of this desc. */ ENDPOINT, /*ENDPOINT descriptor */ 0x83, /*address (IN) */ 0x02, /*attributes (INTERRUPT) */ 0x40,0x00, /*max packet size (64) */ 0xFF, /*interval (ms) */ END_LENGTH, /*length of this desc. */ ENDPOINT, /*ENDPOINT descriptor */ 0x04, /*address (IN) */ 0x02, /*attributes (INTERRUPT) */ 0x40,0x00, /*max packet size (64) */ 0xFF}; /*interval (ms) */ 当只设置一个端点的时候是能够继续运行的。 另外还有一个问题是,在接口描述和端点描述之间有一个HID类的描述,我的设备并不是HID类,但是我把这一段去掉,即使只使用一个端点,控制面板的设备管理和WINDRIVER都不能读到正确的设备配置了,根据资料显示,接口后面的描述直接是端点的描述应该是正确的呀, |
|
沙发#
发布于:2001-08-09 16:58
虽然没有人回复,但还是要感谢大家,是第三字节:total length有误。
不过,利用端点3和端点4进行数据传输目前还调不通,我对端点3和端点4的初始化如下,是不是这而有问题: USBN9603: write_usb(EPC3,0x10); write_usb(TXC2,0x01); write_usb(EPC4,0x14); write_usb(RXC2,0x01); 关于端点控制寄存器EPC我还有点不明白,它的底四位是什么作用,该如何设置,用过USBN9603的朋友请回答。 |
|