wylew 发表于 2018-3-13 22:25:58

双重CDC组合设备问题

做过USB组合设备的能帮忙看看吗?
注册两个CDC类设备,但第二个串口无法工作,第一个CDC用的端点1和2,第二个CDC用的端点3和4无法工作。。。


maxtch 发表于 2018-3-14 07:37:21

你有加 IAD 吗?另外,双重 CDC 是不需要两组控制端口的,一个控制端口两组数据端口就可以了。

wylew 发表于 2018-3-14 08:30:04

本帖最后由 wylew 于 2018-3-14 08:35 编辑

maxtch 发表于 2018-3-14 07:37
你有加 IAD 吗?另外,双重 CDC 是不需要两组控制端口的,一个控制端口两组数据端口就可以了。 ...
/* Configuration 1 descriptor */
    0x09,
    0x02,
    0x8D, 0x00,      //8D , 63
    0x04,               //bNumInterfaces
    0x01,
    0x00,
    0x80,
    0x32,

#if 1      //cdc1, 66 bytes
    /* Interface association descriptor. */
    0x08, 0x0b,
    0x00,               //bFirstInterface
    0x02, 0x02, 0x02, 0x00, 0x00,

    /* Communication Class Interface Descriptor Requirement */
    0x09, 0x04,
    0x00,               //bInterfaceNumber
    0x00,
    0x01,               //bNumEndpoints
    0x02, 0x02, 0x01,
    0x00,

    /* Header Functional Descriptor */
    0x05, 0x24, 0x00, 0x10, 0x01,

    /* ACM Functional Descriptor */
    0x04, 0x24, 0x02, 0x0f,

    /* Union Functional Descriptor */
    0x05, 0x24, 0x06, 0x00, 0x01,

    /* Call Management Functional Descriptor */
    0x05, 0x24, 0x01, 0x03, 0x01,

    /* Endpoint 1 descriptor */
    0x07, 0x05,
    0x86,                //EndpointID = 6 , IN
    0x03,
    0x08, 0x00, 0x0B,

    /* Data Class Interface Descriptor Requirement */
    0x09, 0x04,
    0x01,               //bInterfaceNumber
    0x00,
    0x02,               //bNumEndpoints
    0x0A, 0x00, 0x00,
    0x00,

    /* First alternate setting Endpoint 1 descriptor */
    0x07, 0x05,
    0x01,                //EndpointID = 1, OUT
    0x02,
    0x00, 0x02, 0x00,

    /* Endpoint 2 descriptor */
    0x07, 0x05,
    0x82,                //EndpointID = 2, IN
    0x02,
    0x00, 0x02, 0x00,
#endif
/*************************************************************************************/
#if 2      //cdc2, 66 bytes
    /* Interface association descriptor. */
    0x08, 0x0b,
    0x02,               //bFirstInterface
    0x02, 0x02, 0x02, 0x00, 0x00,

    /* Communication Class Interface Descriptor Requirement */
    0x09, 0x04,
    0x02,               //bInterfaceNumber
    0x00,
    0x01,               //bNumEndpoints
    0x02, 0x02, 0x01,
    0x00,

    /* Header Functional Descriptor */
    0x05, 0x24, 0x00, 0x10, 0x01,

    /* ACM Functional Descriptor */
    0x04, 0x24, 0x02, 0x0f,

    /* Union Functional Descriptor */
    0x05, 0x24, 0x06, 0x00, 0x01,

    /* Call Management Functional Descriptor */
    0x05, 0x24, 0x01, 0x03, 0x01,

    /* Endpoint 1 descriptor */
    0x07, 0x05,
    0x88,                //EndpointID = 8
    0x03,
    0x08, 0x00, 0x0B,

    /* Data Class Interface Descriptor Requirement */
    0x09, 0x04,
    0x03,               //bInterfaceNumber
    0x00,
    0x02,               //bNumEndpoints
    0x0A, 0x00, 0x00,
    0x00,

    /* Endpoint 3 descriptor */
    0x07, 0x05,
    0x03,                //EndpointID = 3, OUT
    0x02,
    0x00, 0x02, 0x00,

    /* Endpoint 4 descriptor */
    0x07, 0x05,
    0x84,                //EndpointID = 4, IN
    0x02,
    0x00, 0x02, 0x00,
#endif
你说的不需要两组控制端口是指在一个控制接口下搭两个数据类接口吗?不过在网上看大家实现的都是控制接口和数据接口一一对应的

anobodykey 发表于 2018-3-27 09:55:07

参考链接:https://www.stmcu.org.cn/module/forum/forum.php?mod=viewthread&tid=613510&highlight=cdc
页: [1]
查看完整版本: 双重CDC组合设备问题