Skip to main content
Denny Smith
Associate II
April 13, 2020
Solved

I have generated a USB CDC Host application on an STM32F407vet based board using the latest version of CubeMX. The resulting code basically works up to the point of getting the data interface where it cannot find a matching interface (0x0A).

  • April 13, 2020
  • 1 reply
  • 752 views

I cannot for the life of me find out where the interface descriptors are defined. Examples I have found on the web indicate ( for a CDC device at least ) a file "usbd_desc.c / h" that contains the definitions. There is no equivalent usbh_desc.c file. I can find the structures ok but not where they are initilised. So, my question is: in which file are the interface descriptors initialised?

This topic has been closed for replies.
Best answer by Denny Smith

Actually cracked it. I was looking for a matching interface in the Cube generated code rather than interogating the device to see what it needs. The function:

interface = USBH_FindInterface(phost, DATA_INTERFACE_CLASS_CODE,

                                RESERVED, VENDOR_SPECIFIC);              //NO_CLASS_SPECIFIC_PROTOCOL_CODE);

when changed to look for "VENDOR_SPECIFIC" instead of the generated "NO_CLASS_SPECIFIC_PROTOCOL_CODE" resulted in getting data coming through. All that was then needed was:

      if(Appli_state == APPLICATION_READY) {

      if(USBH_CDC_Receive(&hUsbHostFS, buff, 1024) == USBH_OK) {

               printf("%s\r\n", buff);

         }

      }

added to the while loop in main();

1 reply

Denny Smith
Denny SmithAuthorBest answer
Associate II
April 13, 2020

Actually cracked it. I was looking for a matching interface in the Cube generated code rather than interogating the device to see what it needs. The function:

interface = USBH_FindInterface(phost, DATA_INTERFACE_CLASS_CODE,

                                RESERVED, VENDOR_SPECIFIC);              //NO_CLASS_SPECIFIC_PROTOCOL_CODE);

when changed to look for "VENDOR_SPECIFIC" instead of the generated "NO_CLASS_SPECIFIC_PROTOCOL_CODE" resulted in getting data coming through. All that was then needed was:

      if(Appli_state == APPLICATION_READY) {

      if(USBH_CDC_Receive(&hUsbHostFS, buff, 1024) == USBH_OK) {

               printf("%s\r\n", buff);

         }

      }

added to the while loop in main();