cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USB Host CDC class: USBH_FindInterface issue

DDeba.1
Associate III

Hi, 

I am using STM32G0B1CBTX and used the STM32CubeMX to configure USB host with CDC class. When connecting a CDC device, I noticed that it passes the enumeration and configuration but fails to find the interface used. More specifically, it fails the function

interface = USBH_FindInterface(phost, COMMUNICATION_INTERFACE_CLASS_CODEABSTRACT_CONTROL_MODEL, COMMON_AT_COMMAND);

at line 158 of the usbh_cdc.c file. Upon deeper inspection, I noticed that the protocol value passed to this function using the macro COMMON_AT_COMMAND is set to 1 while the two interface descriptors I receive from the device both have their interface protocol set to 0. If I manually edit this and use the  NO_CLASS_SPECIFIC_PROTOCOL_CODE macro (value = 0), everything works correctly and I can send and receive data. This part of the library should be fixed and no user editing should be needed. So my question is, is their something wrong with the device's descriptors or can the first call to the USBH_FindInterface be set to have no specific protocol instead of using the COMMON_AT_COMMAND one?

0 REPLIES 0