硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2482|回复: 2
收起左侧

[ThreadX全家桶] USBX复合设备多路串口第二路枚举不到

[复制链接]

4

主题

31

回帖

43

积分

新手上路

积分
43
发表于 2021-1-23 11:40:26 | 显示全部楼层 |阅读模式
本帖最后由 miss-you 于 2021-1-23 11:41 编辑

设备描述符如下。
  1. __ALIGN_BEGIN uint8_t USBD_device_framework_high_speed[] __ALIGN_END =
  2. {
  3.   /* Device descriptor */
  4.   0x12,                                                         /* bLength */
  5.   USB_DESC_TYPE_DEVICE,                                         /* bDescriptorType */
  6.   0x00,                                                         /* bcdUSB */
  7.   0x02,
  8.   0xEF,                                                         /* bDeviceClass */
  9.   0x02,                                                         /* bDeviceSubClass */
  10.   0x01,                                                         /* bDeviceProtocol */
  11.   USB_MAX_EP0_SIZE,                                             /* bMaxPacketSize */
  12.   LOBYTE(USBD_VID),                                             /* idVendor */
  13.   HIBYTE(USBD_VID),                                             /* idVendor */
  14.   LOBYTE(USBD_PID),                                             /* idProduct */
  15.   HIBYTE(USBD_PID),                                             /* idProduct */
  16.   0x00,                                                         /* bcdDevice rel. 2.00 */
  17.   0x02,
  18.   USBD_IDX_MFC_STR,                                             /* Index of manufacturer string */
  19.   USBD_IDX_PRODUCT_STR,                                         /* Index of product string */
  20.   USBD_IDX_SERIAL_STR,                                          /* Index of serial number string */
  21.   USBD_MAX_NUM_CONFIGURATION,                                   /* bNumConfigurations */

  22.   /* Device qualifier descriptor */
  23.   USB_LEN_DEV_QUALIFIER_DESC,
  24.   USB_DESC_TYPE_DEVICE_QUALIFIER,
  25.   0x00,
  26.   0x02,
  27.   0xEF,
  28.   0x02,
  29.   0x01,
  30.   0x40,
  31.   0x01,
  32.   0x00,

  33.   /*Configuration Descriptor*/
  34.   0x09,                                                         /* bLength: Configuration Descriptor size */
  35.   USB_DESC_TYPE_CONFIGURATION,                                  /* bDescriptorType: Configuration */
  36.   USB_CDC_CONFIG_DESC_SIZ*2,                                      /* wTotalLength:no of returned bytes */
  37.   0x00,
  38.   0x04,                                                         /* bNumInterfaces: 2 interface */
  39.   0x01,                                                         /* bConfigurationValue: Configuration value */
  40.   0x00,                                                         /* iConfiguration: Index of string descriptor describing the configuration */
  41.   0xC0,                                                         /* bmAttributes: self powered */
  42.   0x32,                                                         /* MaxPower 100 mA */

  43.   /* Interface association descriptor. 8 bytes. */
  44.   0x08, 0x0b, 0x00,
  45.   0x02, 0x02, 0x02, 0x00, 0x00,
  46.   /*--------------------------------------------------------------------------*/

  47.   /*Interface Descriptor */
  48.   0x09,                                                         /* bLength: Interface Descriptor size */
  49.   USB_DESC_TYPE_INTERFACE,                                      /* bDescriptorType: Interface */
  50.   /* Interface descriptor type */
  51.   0x00,                                                         /* bInterfaceNumber: Number of Interface */
  52.   0x00,                                                         /* bAlternateSetting: Alternate setting */
  53.   0x01,                                                         /* bNumEndpoints: One endpoints used */
  54.   0x02,                                                         /* bInterfaceClass: Communication Interface Class */
  55.   0x02,                                                         /* bInterfaceSubClass: Abstract Control Model */
  56.   0x01,                                                         /* bInterfaceProtocol: Common AT commands */
  57.   0x00,                                                         /* iInterface: */

  58.   /*Header Functional Descriptor*/
  59.   0x05,                                                         /* bLength: Endpoint Descriptor size */
  60.   0x24,                                                         /* bDescriptorType: CS_INTERFACE */
  61.   0x00,                                                         /* bDescriptorSubtype: Header Func Desc */
  62.   0x10,                                                         /* bcdCDC: spec release number */
  63.   0x01,

  64.   /*Call Management Functional Descriptor*/
  65.   0x05,                                                         /* bFunctionLength */
  66.   0x24,                                                         /* bDescriptorType: CS_INTERFACE */
  67.   0x01,                                                         /* bDescriptorSubtype: Call Management Func Desc */
  68.   0x00,                                                         /* bmCapabilities: D0+D1 */
  69.   0x01,                                                         /* bDataInterface: 1 */

  70.   /*ACM Functional Descriptor*/
  71.   0x04,                                                         /* bFunctionLength */
  72.   0x24,                                                         /* bDescriptorType: CS_INTERFACE */
  73.   0x02,                                                         /* bDescriptorSubtype: Abstract Control Management desc */
  74.   0x02,                                                         /* bmCapabilities */

  75.   /*Union Functional Descriptor*/
  76.   0x05,                                                         /* bFunctionLength */
  77.   0x24,                                                         /* bDescriptorType: CS_INTERFACE */
  78.   0x06,                                                         /* bDescriptorSubtype: Union func desc */
  79.   0x00,                                                         /* bMasterInterface: Communication class interface */
  80.   0x01,                                                         /* bSlaveInterface0: Data Class Interface */

  81.   /*Endpoint 2 Descriptor*/
  82.   0x07,                                                         /* bLength: Endpoint Descriptor size */
  83.   USB_DESC_TYPE_ENDPOINT,                                       /* bDescriptorType: Endpoint */
  84.   CDC_CMD_EP,                                                   /* bEndpointAddress */
  85.   0x03,                                                         /* bmAttributes: Interrupt */
  86.   LOBYTE(CDC_CMD_PACKET_SIZE),                                  /* wMaxPacketSize: */
  87.   HIBYTE(CDC_CMD_PACKET_SIZE),
  88.   CDC_HS_BINTERVAL,                                             /* bInterval: */
  89.   /*--------------------------------------------------------------------------*/

  90.   /*Data class interface descriptor*/
  91.   0x09,                                                         /* bLength: Endpoint Descriptor size */
  92.   USB_DESC_TYPE_INTERFACE,                                      /* bDescriptorType: */
  93.   0x01,                                                         /* bInterfaceNumber: Number of Interface */
  94.   0x00,                                                         /* bAlternateSetting: Alternate setting */
  95.   0x02,                                                         /* bNumEndpoints: Two endpoints used */
  96.   0x0A,                                                         /* bInterfaceClass: CDC */
  97.   0x00,                                                         /* bInterfaceSubClass: */
  98.   0x00,                                                         /* bInterfaceProtocol: */
  99.   0x00,                                                         /* iInterface: */

  100.   /*Endpoint OUT Descriptor*/
  101.   0x07,                                                         /* bLength: Endpoint Descriptor size */
  102.   USB_DESC_TYPE_ENDPOINT,                                       /* bDescriptorType: Endpoint */
  103.   CDC_OUT_EP,                                                   /* bEndpointAddress */
  104.   0x02,                                                         /* bmAttributes: Bulk */
  105.   LOBYTE(CDC_DATA_HS_MAX_PACKET_SIZE),                          /* wMaxPacketSize: */
  106.   HIBYTE(CDC_DATA_HS_MAX_PACKET_SIZE),
  107.   0x00,                                                         /* bInterval: ignore for Bulk transfer */

  108.   /*Endpoint IN Descriptor*/
  109.   0x07,                                                         /* bLength: Endpoint Descriptor size */
  110.   USB_DESC_TYPE_ENDPOINT,                                       /* bDescriptorType: Endpoint */
  111.   CDC_IN_EP,                                                    /* bEndpointAddress */
  112.   0x02,                                                         /* bmAttributes: Bulk */
  113.   LOBYTE(CDC_DATA_HS_MAX_PACKET_SIZE),                          /* wMaxPacketSize: */
  114.   HIBYTE(CDC_DATA_HS_MAX_PACKET_SIZE),
  115.   0x00,                                                          /* bInterval: ignore for Bulk transfer */

  116.     0x08, 0x0b, 0x02,
  117.   0x02, 0x02, 0x02, 0x00, 0x00,

  118.     /*Interface Descriptor */
  119.   0x09,                                                         /* bLength: Interface Descriptor size */
  120.   USB_DESC_TYPE_INTERFACE,                                      /* bDescriptorType: Interface */
  121.   /* Interface descriptor type */
  122.   0x02,                                                         /* bInterfaceNumber: Number of Interface */
  123.   0x00,                                                         /* bAlternateSetting: Alternate setting */
  124.   0x01,                                                         /* bNumEndpoints: One endpoints used */
  125.   0x02,                                                         /* bInterfaceClass: Communication Interface Class */
  126.   0x02,                                                         /* bInterfaceSubClass: Abstract Control Model */
  127.   0x01,                                                         /* bInterfaceProtocol: Common AT commands */
  128.   0x00,                                                         /* iInterface: */

  129.   /*Header Functional Descriptor*/
  130.   0x05,                                                         /* bLength: Endpoint Descriptor size */
  131.   0x24,                                                         /* bDescriptorType: CS_INTERFACE */
  132.   0x00,                                                         /* bDescriptorSubtype: Header Func Desc */
  133.   0x10,                                                         /* bcdCDC: spec release number */
  134.   0x01,

  135.   /*Call Management Functional Descriptor*/
  136.   0x05,                                                         /* bFunctionLength */
  137.   0x24,                                                         /* bDescriptorType: CS_INTERFACE */
  138.   0x01,                                                         /* bDescriptorSubtype: Call Management Func Desc */
  139.   0x00,                                                         /* bmCapabilities: D0+D1 */
  140.   0x01,                                                         /* bDataInterface: 1 */

  141.   /*ACM Functional Descriptor*/
  142.   0x04,                                                         /* bFunctionLength */
  143.   0x24,                                                         /* bDescriptorType: CS_INTERFACE */
  144.   0x02,                                                         /* bDescriptorSubtype: Abstract Control Management desc */
  145.   0x02,                                                         /* bmCapabilities */

  146.   /*Union Functional Descriptor*/
  147.   0x05,                                                         /* bFunctionLength */
  148.   0x24,                                                         /* bDescriptorType: CS_INTERFACE */
  149.   0x06,                                                         /* bDescriptorSubtype: Union func desc */
  150.   0x00,                                                         /* bMasterInterface: Communication class interface */
  151.   0x01,                                                         /* bSlaveInterface0: Data Class Interface */

  152.   /*Endpoint 2 Descriptor*/
  153.   0x07,                                                         /* bLength: Endpoint Descriptor size */
  154.   USB_DESC_TYPE_ENDPOINT,                                       /* bDescriptorType: Endpoint */
  155.   CDC2_CMD_EP,                                                   /* bEndpointAddress */
  156.   0x03,                                                         /* bmAttributes: Interrupt */
  157.   LOBYTE(CDC_CMD_PACKET_SIZE),                                  /* wMaxPacketSize: */
  158.   HIBYTE(CDC_CMD_PACKET_SIZE),
  159.   CDC_FS_BINTERVAL,                                             /* bInterval: */
  160.   /*--------------------------------------------------------------------------*/

  161.   /*Data class interface descriptor*/
  162.   0x09,                                                         /* bLength: Endpoint Descriptor size */
  163.   USB_DESC_TYPE_INTERFACE,                                      /* bDescriptorType: */
  164.   0x03,                                                         /* bInterfaceNumber: Number of Interface */
  165.   0x00,                                                         /* bAlternateSetting: Alternate setting */
  166.   0x02,                                                         /* bNumEndpoints: Two endpoints used */
  167.   0x0A,                                                         /* bInterfaceClass: CDC */
  168.   0x00,                                                         /* bInterfaceSubClass: */
  169.   0x00,                                                         /* bInterfaceProtocol: */
  170.   0x00,                                                         /* iInterface: */

  171.   /*Endpoint OUT Descriptor*/
  172.   0x07,                                                         /* bLength: Endpoint Descriptor size */
  173.   USB_DESC_TYPE_ENDPOINT,                                       /* bDescriptorType: Endpoint */
  174.   CDC2_OUT_EP,                                                   /* bEndpointAddress */
  175.   0x02,                                                         /* bmAttributes: Bulk */
  176.   LOBYTE(CDC_DATA_FS_MAX_PACKET_SIZE),                          /* wMaxPacketSize: */
  177.   HIBYTE(CDC_DATA_FS_MAX_PACKET_SIZE),
  178.   0x00,                                                         /* bInterval: ignore for Bulk transfer */

  179.   /*Endpoint IN Descriptor*/
  180.   0x07,                                                         /* bLength: Endpoint Descriptor size */
  181.   USB_DESC_TYPE_ENDPOINT,                                       /* bDescriptorType: Endpoint */
  182.   CDC2_IN_EP,                                                    /* bEndpointAddress */
  183.   0x02,                                                         /* bmAttributes: Bulk */
  184.   LOBYTE(CDC_DATA_FS_MAX_PACKET_SIZE),                          /* wMaxPacketSize: */
  185.   HIBYTE(CDC_DATA_FS_MAX_PACKET_SIZE),
  186.   0x00,                                                          /* bInterval: ignore for Bulk transfer */


  187. };
复制代码

端点
  1. #define CDC_IN_EP                                       0x83U  /* EP3 for data IN */
  2. #define CDC_OUT_EP                                      0x01U  /* EP1 for data OUT */
  3. #define CDC_CMD_EP                                      0x82U  /* EP2 for CDC commands */

  4. #define CDC2_IN_EP                                       0x85U  /* EP3 for data IN */
  5. #define CDC2_OUT_EP                                      0x03U  /* EP1 for data OUT */
  6. #define CDC2_CMD_EP                                      0x84U  /* EP2 for CDC commands */
复制代码

请问一下以上的描述符是否有什么问题



回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115804
QQ
发表于 2021-1-23 11:45:42 | 显示全部楼层
还没有研究过USBX符合设备。

你做复合设备,最好不同复合使用不容端点。一个端点有一个输入和一个输出。另外特别注意你所使用的芯片有几个端点。
回复

使用道具 举报

4

主题

31

回帖

43

积分

新手上路

积分
43
 楼主| 发表于 2021-1-23 12:20:13 | 显示全部楼层
eric2013 发表于 2021-1-23 11:45
还没有研究过USBX符合设备。

你做复合设备,最好不同复合使用不容端点。一个端点有一个输入和一个输出。 ...

上面所使用的端点都是不一样的,我用的H750的片子
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-5-20 01:38 , Processed in 0.232588 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表