cancel
Showing results for 
Search instead for 
Did you mean: 

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).

Denny Smith
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Denny Smith
Associate II

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

View solution in original post

1 REPLY 1
Denny Smith
Associate II

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