USB CDC 只工作一次 w/interupt endp

USB CDC work only once w/ interupt endp

我正在 STM32F4 MCU 上实现虚拟 COM 端口。

MCU 没有可用的端点,所以我必须删除中断 endpoint/notification 元素。 问题是MCU只能给pc发送一次信息,之后pc就收不到了。

设备 USB 描述符:

Interface Association Descriptor:
------------------------------
0x08    bLength
0x0B    bDescriptorType
0x02    bFirstInterface
0x02    bInterfaceCount
0x02    bFunctionClass   (Communication Device Class)
0x02    bFunctionSubClass   (Abstract Control Model)
0x01    bFunctionProtocol   (ITU-T V.250)
0x06    iFunction

Interface Descriptor:
------------------------------
0x09    bLength
0x04    bDescriptorType
0x02    bInterfaceNumber
0x00    bAlternateSetting
0x00    bNumEndPoints
0x02    bInterfaceClass   (Communication Device Class)
0x02    bInterfaceSubClass   (Abstract Control Model)
0x01    bInterfaceProtocol   (ITU-T V.250)
0x02    iInterface   ""

CDC Header Functional Descriptor:
------------------------------
0x05    bFunctionalLength
0x24    bDescriptorType
0x00    bDescriptorSubtype
0x0110  bcdCDC

CDC Call Management Functional Descriptor:
------------------------------
0x05    bFunctionalLength
0x24    bDescriptorType
0x01    bDescriptorSubtype
0x00    bmCapabilities
0x01    bDataInterface

CDC Abstract Control Management Functional Descriptor:
------------------------------
0x04    bFunctionalLength
0x24    bDescriptorType
0x02    bDescriptorSubtype
0x02    bmCapabilities

CDC Union Functional Descriptor:
------------------------------
0x05    bFunctionalLength
0x24    bDescriptorType
0x06    bDescriptorSubtype
0x00    bControlInterface
0x01    bSubordinateInterface(0)

Interface Descriptor:
------------------------------
0x09    bLength
0x04    bDescriptorType
0x03    bInterfaceNumber
0x00    bAlternateSetting
0x02    bNumEndPoints
0x0A    bInterfaceClass   (CDC Data)
0x00    bInterfaceSubClass   
0x00    bInterfaceProtocol   
0x02    iInterface   ""

Endpoint Descriptor:
------------------------------
0x07    bLength
0x05    bDescriptorType
0x03    bEndpointAddress   (OUT Endpoint)
0x02    bmAttributes    (Transfer: Bulk / Synch: None / Usage: Data)
0x0010  wMaxPacketSize   (16 Bytes) 
0x00    bInterval

Endpoint Descriptor:
------------------------------
0x07    bLength
0x05    bDescriptorType
0x85    bEndpointAddress   (IN Endpoint)
0x02    bmAttributes    (Transfer: Bulk / Synch: None / Usage: Data)
0x0010  wMaxPacketSize   (16 Bytes) 
0x00    bInterval

如果我删除这个无用的端点,usbser windows 驱动程序就会发疯。 所以你必须有一个中断 IN 端点,即使应用程序从未使用过它。