cancel
Showing results for 
Search instead for 
Did you mean: 

Generic HID on STM32L053

aravinda
Associate II
Posted on October 16, 2015 at 11:37

We are using STM32L053 in our project. We evaluated the USB data transfer using CDC(Virtual COM port) and USB composite device. However, both of them require specific ST drivers for the PC to recognize the USB device. We are looking at options to avoid this. In the example applications provided for L053, there is a HID example which we tested. This one configures the device as a �mouse� and does not need any specific drivers. However, we do not need the mouse functionality. Is it possible that we modify the HID example to configure the device as a generic HID device so that data can be sent/received without needing any specific drivers? If this is possible, are there freely available PC applications that can receive(log)/send data from/to HID devices?

In our application, we have a requirement to read the data stored in EEPROM and transfer that to the PC. Hence, a maximum of few kilobytes of data will be transferred. Also, they are not sent all at once, they are sent in packets and this size can be well within 64 bytes. We also do not need a very high data transfer rate. In addition, we would also like to send some data from the PC to the device (bidirectional). We intend to send the data to the PC in a readable ASCII format and would like to log that in excel.(We have tested this using Hercules application with USB CDC. We want to know if there is something similar for HID)

In fact, in one of the forums 

http://electronics.stackexchange.com/questions/121904/what-usb-class-should-i-implement?answertab=active&sharptab-top

 indicates that it is possible to use HID to log the ASCII data in Excel. How can the USB HID descriptors have to be modified so that we can use HID for generic USB send/receive functionality?

#stm32 #usb #hid
6 REPLIES 6
qwer.asdf
Senior
aravinda
Associate II
Posted on October 16, 2015 at 12:23

Thanks for sharing the links. Even I had seen some custom HID examples on other variants of STM32. What I need is on STM3L0 series..Are there any ones already existing.

Regards,

Aravinda

qwer.asdf
Senior
Posted on October 16, 2015 at 12:31

I can't find examples for L0. The project at the first link is based on HAL which is very portable. It should be straightforward to adapt the F1 code to you L0 board.

aravinda
Associate II
Posted on October 16, 2015 at 14:04

Yeah..I ported the code in the first link for L0. Now, when I run it on the system, Windows identifies it as USB Input device. In addition, a HID-compliant Mouse also appears in the device manager but there is a warning icon that this cannot start . Is this the expected enumeration for the Custom HID example?

Also, which application do I use on the PC to test data transfer with the USB input device?

Regards,

Aravinda

qwer.asdf
Senior
Posted on October 16, 2015 at 15:01

Did you change the VID/PID/Serial Number of your device? Change at least the serial number so Windows can re-run the device registration/recognition.

> Also, which application do I use on the PC to test data transfer with the USB input device?

http://www.st.com/web/en/catalog/tools/PF257920#

aravinda
Associate II
Posted on October 19, 2015 at 12:42

I changed the Serial Number of the device. But still, the report descriptor in usbd_custom_hid_if.c file in 1st link corresponds to the USAGE mouse. When this descriptor was modified to have an Undefined USAGE, I can see a generic HID compliant  device in the device manager, I have the application USB HID Demonstrator and I can see that this can identify the device. However, sending and receiving data is not very intutive/user friendly in this application. I searched the net and found YAT- Yet Another Terminal application useful for this purpose.

Thanks,

Aravinda