Skip to main content
Denny Smith
Associate II
Apr 13, 2020 6:47 AM UTC
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).

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.
Denny Smith
Denny SmithBest answer
Associate II
Apr 13, 2020 11:57 PM UTC

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
Apr 13, 2020 11:57 PM UTC

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();