2017-02-27 02:01 PM
Hey guys.
I'm trying to setup Custom HID. I'd like to use an output- and input Buffer.
I have managed to setup the descriptors. I think i have done that right: Windows is correct enumerating my device.
On the other side I got a C# HID API. The Initialisation works, the HID descriptors are successfully exchanged (Output Buffer Size, Input Buffer Size are correctly recognised).
However when I try to send to send/receive message the sending/receiving fails.
in the usbd_custom_hid.c the is an USBD_ClassTypeDef USBD_CUSTOM_HID which contains pointer to serveral functions
USBD_ClassTypeDef USBD_CUSTOM_HID =
{ USBD_CUSTOM_HID_Init, USBD_CUSTOM_HID_DeInit, USBD_CUSTOM_HID_Setup, NULL, /*EP0_TxSent*/ USBD_CUSTOM_HID_EP0_RxReady, /*EP0_RxReady*/ /* STATUS STAGE IN */ USBD_CUSTOM_HID_DataIn, /*DataIn*/ USBD_CUSTOM_HID_DataOut, NULL, /*SOF */ NULL, NULL, USBD_CUSTOM_HID_GetCfgDesc, USBD_CUSTOM_HID_GetCfgDesc, USBD_CUSTOM_HID_GetCfgDesc, USBD_CUSTOM_HID_GetDeviceQualifierDesc,};However these functions are never called. I tried calling the USBD_CUSTOM_HID_Init function manually but this did not solve the problem.
Could you help me out what to do with this ClassTypedef?
greets Julian
2017-05-26 09:07 AM
Hello Julian, I'm facing the same issue, did you make it work?
Thank you!
Fernando
2017-05-27 04:45 AM
,
,
hey,
yep i did cost me some time to figure it out, but after searching on the internet for some time i found a really helpful tutorial
https://www.youtube.com/watch?v=xufZyQf4O7Y
,i configured the Custom HID driver exactly the same as the guy in the video and it worked
To verfiy that the driver works, i tested some C ♯ Hid libraries. I think it was simplehid and mightyhid. Turned out that both of them worked with my disco board. Hope that helps
2017-05-29 03:04 AM
Hi
Blaha.Fernando
,To have more insight into the USB HID, you can review the USB libraries and start from the
USB HID
example of the STM32Cube firmware package relevant to the device that you are using.Imen
2017-05-29 06:51 AM
Thank you Julian! I will follow your advice with this tutorial, surelly it will be helpfull.
Thank you again!
Fernando
2017-05-29 06:52 AM
Thank you Imen, that's what I did, but found the limitation that the library is not prepared yet to receive data, only transmit with HID.
I need bidirectional communication.
Thank you!
Fernando
2017-05-29 03:03 PM
the report descriptor in the STM Cube example is for a keyboard. That's why you can only send data. A keyboard does not need to receive data. In windows device manager your HID device will appear as keyboard.
I had the same problem: My communication needed to be both ways as well, that's why I used the report descriptor (shown in the youtube video) for a CUSTOM Hid device. Windows recognises the custom hid device properly as 'Custom HID Device'
FYI: in HID protocol (HID and Custom HID) you can only transfer max 64 bytes per interrupt since the HID protocol was originally developed for input devices which needed to respond fast. This site is really helpful for understanding the basics of USB.
2017-05-30 06:45 AM
Hi!
I've already worked with HID, but only with Microchip microcontrollers, and the library already was quite finished. Now with ST I'm facing this issues, that needs to get a little more involved with USB to finish the full functionallity.
I'm working on it, I'll let you know
Thank you very much Julian for your help!
Fernando
2017-06-15 11:32 AM
It worked
Thank you very much! You really helped me.
Fernando