AnsweredAssumed Answered

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

Question asked by Marek Novak on Apr 30, 2018
Latest reply on May 3, 2018 by pavel a



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 CP2110. 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,