打印

cypress USB复合设备,枚举不成功?

[复制链接]
1161|4
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
caihong001|  楼主 | 2014-10-8 09:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
用CY7C63813做了个USB(键盘+鼠标)复合设备,不过枚举不成功

单独的键盘或鼠标都是正常的,但加一起后就死在while(!USB_bGetConfiguration());这个里面,  用逻辑分析仪采数据后发现,在读取设备描述符(Get Descriptor)->配置地址(Set Address)->重新读取设备描述符(Get Descriptor)->读取配置描述符(Get Configuration)后,没有Set Configuration
有人搞过没?网上关于CYPRESS的复合设备资料太少了
沙发
USB-Emily| | 2014-10-14 15:43 | 只看该作者
即使是复合设备,但是他们有不通的device descriptor,不同的address等,是不是描述符里面数据有冲突?

使用特权

评论回复
板凳
USB-Emily| | 2014-10-14 15:44 | 只看该作者
即使是复合设备,但是他们有不通的device descriptor,不同的address等,是不是描述符里面数据有冲突?

使用特权

评论回复
地板
zengweitotty| | 2014-10-16 13:05 | 只看该作者
楼上的朋友,你的描述符能否发一个看看,我做HID 鼠标和键盘的复合设备是一个配置描述符,两个接口描述符。
下面的描述符不是针对68013的,但是你可以照着改改的。
code const usb_conf_desc_templ_t g_usb_conf_desc =
{
  { // configuration_descriptor hid_configuration_descriptor
    sizeof(hal_usb_conf_desc_t),         // Length
    0x02,                               // Type                             
    SWAP(sizeof(usb_conf_desc_templ_t)),        // Totallength
    0x02,                               // NumInterfaces
    0x01,                               // bConfigurationValue
    0x00,                               // iConfiguration
    0xA0,                               // bmAttributes (0x80 + Remote Wakeup)
    0x32                                // MaxPower (in 2mA units) = 100 * 2mA
  },
  { // interface_descriptor hid_interface_descriptor    (keyboard)
    sizeof(hal_usb_if_desc_t),          // Length
    0x04,                               // bDescriptorType
    0x00,                               // bInterfaceNumber
    0x00,                               // bAlternateSetting
    0x01,                               // bNumEndpoints
    0x03,                               // bInterfaceClass (3 = HID)
    0x01,                               // bInterfaceSubClass
    0x01,                               // bInterfaceProcotol(0=None, 1=Keyb, 2=Mouse)
    0x00                                // iInterface
  },
       
  { // class_descriptor hid_descriptor keyboard
    sizeof(hal_usb_hid_desc_t),          // Length
    0x21,                                    // bDescriptorType
    SWAP(0x0100),                            // bcdHID
    0x00,                                    // bCountryCode
    0x01,                                    // bNumDescriptors
    0x22,                               // bDescriptorType
    SWAP(HID_REPORT1_DESCRIPTOR_SIZE_RC),// wItemLength (tot. len. of report
                                        // descriptor)
  },
  { // endpoint_descriptor hid_endpoint_in_descriptor keyboard
    sizeof(hal_usb_ep_desc_t),          // Length
    0x05,                               // bDescriptorType
    0x81,                               // bEndpointAddress
    0x03,                               // bmAttributes
    SWAP(EP1_PACKET_SIZE),              // MaxPacketSize (LITTLE ENDIAN)
    2                                  // bInterval
  },
       
        {
                // interface_descriptor hid_interface_descriptor    (mouse)
    sizeof(hal_usb_if_desc_t),          // Length
    0x04,                               // bDescriptorType
    0x01,                               // bInterfaceNumber
    0x00,                               // bAlternateSetting
    0x01,                               // bNumEndpoints
    0x03,                               // bInterfaceClass (3 = HID)
    0x01,                               // bInterfaceSubClass
    0x02,                               // bInterfaceProcotol(0=None, 1=Keyb, 2=Mouse)
    0x00                                // iInterface
        },
        { // class_descriptor hid_descriptor mouse
    sizeof(hal_usb_hid_desc_t),          // Length
    0x21,                                    // bDescriptorType
    SWAP(0x0100),                            // bcdHID
    0x00,                                    // bCountryCode
    0x01,                                    // bNumDescriptors
    0x22,                               // bDescriptorType
    SWAP(HID_REPORT2_DESCRIPTOR_SIZE_RC),// wItemLength (tot. len. of report
                                        // descriptor)
  },
        { // endpoint_descriptor hid_endpoint_in_descriptor mouse
    sizeof(hal_usb_ep_desc_t),          // Length
    0x05,                               // bDescriptorType
    0x82,                               // bEndpointAddress
    0x03,                               // bmAttributes
    SWAP(EP2_PACKET_SIZE),              // MaxPacketSize (LITTLE ENDIAN)
    2                                  // bInterval
  },
       
};

使用特权

评论回复
5
匿名  2014-10-17 16:30
你用下面程序枚举即可:
楼上的朋友,你的描述符能否发一个看看,我做HID 鼠标和键盘的复合设备是一个配置描述符,两个接口描述符。
下面的描述符不是针对68013的,但是你可以照着改改的。
code const usb_conf_desc_templ_t g_usb_conf_desc =
{
  { // configuration_descriptor hid_configuration_descriptor
    sizeof(hal_usb_conf_desc_t),         // Length
    0x02,                               // Type                             
    SWAP(sizeof(usb_conf_desc_templ_t)),        // Totallength
    0x02,                               // NumInterfaces
    0x01,                               // bConfigurationValue
    0x00,                               // iConfiguration
    0xA0,                               // bmAttributes (0x80 + Remote Wakeup)
    0x32                                // MaxPower (in 2mA units) = 100 * 2mA
  },
  { // interface_descriptor hid_interface_descriptor    (keyboard)
    sizeof(hal_usb_if_desc_t),          // Length
    0x04,                               // bDescriptorType
    0x00,                               // bInterfaceNumber
    0x00,                               // bAlternateSetting
    0x01,                               // bNumEndpoints
    0x03,                               // bInterfaceClass (3 = HID)
    0x01,                               // bInterfaceSubClass
    0x01,                               // bInterfaceProcotol(0=None, 1=Keyb, 2=Mouse)
    0x00                                // iInterface
  },
        
  { // class_descriptor hid_descriptor keyboard
    sizeof(hal_usb_hid_desc_t),          // Length
    0x21,                                    // bDescriptorType
    SWAP(0x0100),                            // bcdHID
    0x00,                                    // bCountryCode
    0x01,                                    // bNumDescriptors
    0x22,                               // bDescriptorType
    SWAP(HID_REPORT1_DESCRIPTOR_SIZE_RC),// wItemLength (tot. len. of report
                                        // descriptor)
  },
  { // endpoint_descriptor hid_endpoint_in_descriptor keyboard
    sizeof(hal_usb_ep_desc_t),          // Length
    0x05,                               // bDescriptorType
    0x81,                               // bEndpointAddress
    0x03,                               // bmAttributes
    SWAP(EP1_PACKET_SIZE),              // MaxPacketSize (LITTLE ENDIAN)
    2                                  // bInterval
  },
        
        {
                // interface_descriptor hid_interface_descriptor    (mouse)
    sizeof(hal_usb_if_desc_t),          // Length
    0x04,                               // bDescriptorType
    0x01,                               // bInterfaceNumber
    0x00,                               // bAlternateSetting
    0x01,                               // bNumEndpoints
    0x03,                               // bInterfaceClass (3 = HID)
    0x01,                               // bInterfaceSubClass
    0x02,                               // bInterfaceProcotol(0=None, 1=Keyb, 2=Mouse)
    0x00                                // iInterface
        },
        { // class_descriptor hid_descriptor mouse
    sizeof(hal_usb_hid_desc_t),          // Length
    0x21,                                    // bDescriptorType
    SWAP(0x0100),                            // bcdHID
    0x00,                                    // bCountryCode
    0x01,                                    // bNumDescriptors
    0x22,                               // bDescriptorType
    SWAP(HID_REPORT2_DESCRIPTOR_SIZE_RC),// wItemLength (tot. len. of report
                                        // descriptor)
  },
        { // endpoint_descriptor hid_endpoint_in_descriptor mouse
    sizeof(hal_usb_ep_desc_t),          // Length
    0x05,                               // bDescriptorType
    0x82,                               // bEndpointAddress
    0x03,                               // bmAttributes
    SWAP(EP2_PACKET_SIZE),              // MaxPacketSize (LITTLE ENDIAN)
    2                                  // bInterval
  },
        
};

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

46

主题

91

帖子

1

粉丝