查看: 254|回复: 0

CH32V307 修改usb例程,出现两个设备

[复制链接]
  • TA的每日心情

    2024-11-15 16:19
  • 签到天数: 3 天

    [LV.2]偶尔看看I

    292

    主题

    26

    回帖

    2978

    积分

    管理员

    积分
    2978
    发表于 2024-11-18 10:05:58 | 显示全部楼层 |阅读模式
    利用CH32V307的例程修改了配置描述符,结果插到usb上识别是两个一个样的VID和PID的设备,一个用libusb安装了驱动,想知道哪里出错了,为啥是两个名字一样的设备!
    const uint8_t  MyDevDescr[ ] =
    {
        0x12,       // bLength
        0x01,       // bDescriptorType (Device)
        0x00, 0x02, // bcdUSB 2.00
        0x00,       // bDeviceClass
        0x00,       // bDeviceSubClass
        0x00,       // bDeviceProtocol
        DEF_USBD_UEP0_SIZE,   // bMaxPacketSize0 64
        (uint8_t)DEF_USB_VID, (uint8_t)(DEF_USB_VID >> 8),  // idVendor 0x1A86
        (uint8_t)DEF_USB_PID, (uint8_t)(DEF_USB_PID >> 8),  // idProduct 0x5537
        DEF_IC_PRG_VER, 0x00, // bcdDevice 0.01
        0x01,       // iManufacturer (String Index)
        0x02,       // iProduct (String Index)
        0x03,       // iSerialNumber (String Index)
        0x01,       // bNumConfigurations 1
    };

    const uint8_t  MyCfgDescr_HS[ ] =
    {
        /* Configure descriptor */
        0x09, 0x02, 0x30, 0x00, 0x02, 0x01, 0x00, 0x80, 0x32,

        /* Interface 0 (CDC) descriptor */
        0x09, 0x04, 0x00, 0x00, 0x01, 0xff, 0x02, 0x01, 0x00,

        /* Interrupt upload endpoint descriptor */
        0x07, 0x05, 0x83, 0x03, (uint8_t)DEF_USB_EP3_FS_SIZE, (uint8_t)( DEF_USB_EP3_FS_SIZE >> 8 ), 0x01,

        /* Interface 1 (data interface) descriptor */
        0x09, 0x04, 0x01, 0x00, 0x02, 0xff, 0x00, 0x00, 0x00,

        /* Endpoint descriptor */
        0x07, 0x05, 0x02, 0x02, (uint8_t)DEF_USB_EP2_HS_SIZE, (uint8_t)( DEF_USB_EP2_HS_SIZE >> 8 ), 0x00,

        /* Endpoint descriptor */
        0x07, 0x05, 0x82, 0x02, (uint8_t)DEF_USB_EP2_HS_SIZE, (uint8_t)( DEF_USB_EP2_HS_SIZE >> 8 ), 0x00,
    };

    这是在SinulateCDC项目基础上修改的。

    没安装驱动的时候,出现两个 usb serial ,这个usb serial是芯片内的名字

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

    本版积分规则

    友情链接:

    返回顶部 返回列表