cancel
Showing results for 
Search instead for 
Did you mean: 

stm32n6 usbd composite cdc+uvc failed to enumerate under windows

sebastien.marion
Associate II

Hi,

The project was created in stm32mx from the example project cortexm_sysk.
It was generated as a CMake project and developed using VS Code.

The "USB Device Middleware Library MCU Software Component" library, version "V2.11.4 / 11-April-2025", was manually added.

CDC alone OK

UVC alone OK

CDC/HID OK

CDC/UVC NOT OK

See file in attachment.

I noticed the file descriptor is large (239 bytes). Is that a problem?

Is there another setting I need to change?

Regards,
Sébastien

5 REPLIES 5
FBL
ST Employee

Hi @sebastien.marion 

Based on your description, the behavior strongly points to an issue in the CDC + UVC configuration / class descriptors. To avoid guessing, the most helpful next step is a full descriptor dump of the failing CDC UVC configuration. If possible, provide USB trace using usb protocol analyzer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.




Best regards,
FBL

Hi @FBL 

Found in attachment wireshark capture of three configuration cdc only, uvc only, cdc+uvc.

I zip the prohect too, change define at the top of file usbd_conf.h to change configuration.

I see now enumerate cdc-uvc seem's right but only cdc is view by windows and functionnal, not the uvc.

 

regards,

Sébastien

FBL
ST Employee

Hi @sebastien.marion,

Thanks for sharing the traces and project.

From the USBPcap/Wireshark capture, the CDC+UVC configuration descriptor that Windows receives is structurally almost correct, but there is a descriptor inconsistency in the Video interface collection that explains why only CDC is exposed.

In your composite configuration: the UVC IAD correctly groups:

  • Interface 2: VideoControl (VC)
  • Interface 3: VideoStreaming (VS)

However, two fields still use interface numbers from the standalone UVC configuration (VC = 0, VS = 1):

  1. VideoControl header baInterfaceNr

    • bInCollection = 1
    • baInterfaceNr[0] = 1

    This value 1 is correct in a standalone UVC device (VS at interface 1), but in the composite build the VS interface is actually interface 3. So the VC header should point to interface 3, not 1.

  2. VideoStreaming alternate setting 1

    The descriptors show:

    • VS alt 0: interface 3, bAlternateSetting = 0, bNumEndpoints = 0 
    • VS alt 1: interface 1, bAlternateSetting = 1, bNumEndpoints = 1 

    For UVC, all alternate settings of the VideoStreaming interface must use the same interface number. In your composite, VS alt 1 should also be interface 3, not 1 (which is used by the CDC-Data interface).

Because of these mismatches (VC header pointing to 1, VS alt 1 declared as interface 1 while the IAD says the UVC function is on interfaces 2–3), the Windows UVC driver rejects the Video interface collection and does not bind to it. CDC remains valid, so only CDC is visible and functional.

The fix should be in the composite builder function USBD_CMPSIT_VIDEODesc():

  1. Use the dynamically assigned VS interface number in the VC header

    Replace the hard coded 1 with the actual VS interface index assigned by the composite builder:

    /* Class-specific VC Interface Header */
    pSVCInDesc->bInCollection = 0x01U;
    pSVCInDesc->baInterfaceNr = (uint8_t)pdev->tclasslist[pdev->classId].Ifs[1];

    Here:

    • Ifs[0] = VC interface number
    • Ifs[1] = VS interface number (shared by all VS alternate settings)
  2. Use the same VS interface number for the alt 1 interface descriptor

    Replace the hard coded interface number 1U:

    /* USB Standard VS Interface Descriptor - data transfer mode */
    /* Same interface as VS alt 0, Alternate Setting 1 */
    __USBD_CMPSIT_SET_IF(pdev->tclasslist[pdev->classId].Ifs[1],
                         1U,  /* AlternateSetting */
                         1U,  /* bNumEndpoints */
                         UVC_CC_VIDEO,
                         SC_VIDEOSTREAMING,
                         PC_PROTOCOL_UNDEFINED,
                         0U);

     

This ensures that VS alt 0 and VS alt 1 both use the same interface number 3.

After these two changes, the UVC IAD (interfaces 2–3), VC header, and VS descriptors all should be consistent.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.




Best regards,
FBL

Hi,

Thank you for your answer.

I made the change, but unfortunately only the CDC is visible in the Windows Device Manager.

I've attached a Wireshark capture.
What checks can I perform?

regards,

Sébastien

FBL
ST Employee

Hi @sebastien.marion 

bAlternateSetting is still zero in frame 10 and 13 

FBL_0-1776079751024.png

FBL_1-1776080397009.png

I'm suspecting something missing in composite builder class. Let me check and get back to you.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.




Best regards,
FBL