cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USB HID host with CP2110 - problems with modyfing the code

Marek Novak
Associate II
Posted on April 30, 2018 at 23:15

Hi,

I have a project where I need to communicate with CP2110 via USB (medical device having this interface). I am prototyping the application on STM32F746G-DISCO. I have started by running the Application example HID USBH_FS where I can plug in a USB mouse or keyboard the receive the data. This works so far. Then, I have started modyfing the code for CP2 First, I have tried to plug in the device as-is. It got correctly enumerated as CP2110 HID to Serial converter but obviously failed during execution of USBH_HID_InterfaceInit. I have edited following code so it passes the USBH_HID_InterfaceInit function with HID class started message:

interface = USBH_FindInterface(phost, phost->pActiveClass->ClassCode, 0x00, 0xFF);�?

The Subclass of the device is not 0x01 (boot device) as for USB keyboard and mouse but 0x00. Next, I have added this code to the if-elseif structure determining whether it is a keyboard, mouse or not compatible device:

else if(phost->device.DevDesc.idVendor==0x10C4 && phost->device.DevDesc.idProduct==0xEA80) // CP2110
 {
 USBH_UsrLog ('CP2110 device found!');
 HID_Handle->Init = USBH_HID_MouseInit;
 }�?�?�?�?�?

I have kept the MouseInit function in there for now. I don't suspect it could cause any problems .. or could it?

So I have the HID class started. Now I am starting to be a little bit struggling as the HID Host library provided by ST seems not to be complete and finished. It has functions for getting the HID reports which is perfectly fine for keyboard and mouse but I need to transmit a report in order to configure the device. I tried to google for the solution but it always failed - either freezes after HID class start or is not compatible with the current library version.

Are there any working examples or any documentation which could help in implementing the USB HID Host for CP2110?

Any help would be really appreciated,

Best Regards,

Marek.

13 REPLIES 13
reserv70
Associate II
Posted on June 06, 2018 at 08:42

I have working code. But this is not 'good style' code.   Oh! Sorry! My code for cp2102...

Hello! I have started of trying to communicate as usb host with cp2102, can you please send me your working code? ivan-dm@yandex.ru

@Marek Novak​ 

did you get this running ?

can you show me how to implement USBH_HID_SetReport

specifically I cannot find a reference to "Report Type"

Can I take a look to your code please? I am working on creating the communication as USB host with CP2104 ?

mohsen.mohaidat@gmail.com