cancel
Showing results for 
Search instead for 
Did you mean: 

USB Host USBH_HID_SetReport function issue

DDeba.1
Associate III

Hi, 

I am using an STM32G0B1CT6 and generated code using the STM32CubeMX to use the USB Host library to interface the CP2112 device. I am able to enumerate and communicate with the device using the interrupt IN/OUT. I am also able to get reports using the USBH_HID_GetReport function. But when I try to set some SMBUS configurations using the USBH_HID_SetReport function, it doesn't work (I'm checking this by reading back the configurations). 

Additionally, I see that the USBH_HID_SetReport function takes a reportType as argument appart from the reportID. What is the reportType? as a side note, according to AN495 of the CP2112, the configuration I am trying to set should be transmitted as a Feature request with a report ID of 0x06. 

Any ideas why this function may not work?

Thanks

3 REPLIES 3
FBL
ST Employee

Hi @DDeba.1 

AFAIK, USBH_HID_SetReport is class request for sending Report OUT data. Not sure about reportType. Try this instead of using USBH_HID_SetReport.

As mentioned in AN495 of the CP2112, in response to a Set Report, the CP2112 will not return any report or acknowledgement of a report.

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.


DDeba.1
Associate III

Hi @FBL ,

Thanks for the quick reply. For testing, I was using the USBH_HID_SetReport to change some configurations and than use the USBH_HID_GetReport to read them back. The USBH_HID_GetReport is working but it is always returning the default configuration values, thus I am assuming that the USBH_HID_SetReport is not working. 

Regarding your link: The proposed solution is to be implemented in the case of Interrupt IN request. How is this related with the USBH_HID_SetReport fucntion?

DDeba.1
Associate III

HI @FBL ,

On further testing, I found the issue. Even though the USBH_HID_SetReport takes reportId as an argument, the report ID must also be included as the first byte in the data buffer (reportBuff). Would be handy if this information is listed somewhere. In addition, would also be handy if the report types macros are listed. For anyone's who needs them 

Input Report: 0x01

Output Report: 0x02

Feature Report: 0x03