Search code examples
usbcdcstm32f4usb-descriptor

USB CDC work only once w/ interupt endp


I'm implementing a Virtual COM port on an STM32F4 MCU.

The MCU don't have endpoints left available so I have to revome interupt endpoint/notification element. The problem is the MCU can send a message to the pc only once, after the pc will not get it.

The device USB descriptor:

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

Solution

  • If i remove this useless endpoint the usbser windows driver go nuts. So You have to have an interupt IN endpoint even if the application never ever use it.