2022-05-21 06:16 AM
I am using STM32L1 series and configured it as as custom HID device. I am able to receive data from PC and able to respond once using USBD_CUSTOM_HID_SendReport function. If i am trying to send again data to PC using the same function it is not working. It is going to either USB device status as busy or device state suspended.
I have used "09.7_USB HID device - custom device lab" document to configure the project. Please let me know how to figure out the issue.
2022-05-21 08:55 AM
Here is a real solution:
https://github.com/hathach/tinyusb/tree/master/examples/device/hid_generic_inout
2022-05-22 10:20 PM
@Piranha I was trying to understand the issue using STM library itself. Have you tried it using the same?
2022-05-23 03:52 PM
After the experience with Ethernet and seeing the code that team writes everywhere, when I needed USB, I didn't waste my time on a broken bloatware written by incompetent "developers" and went strait to TinyUSB. Works as a charm!
And ST's USB stack does everything in ISRs, which is a ridiculously dumb and limiting design.
2022-05-23 06:58 PM
@Piranha Thank you for your suggestions. I will look into TinyUSB implementation.
2022-05-23 07:02 PM
@Amel NASRI Could you help me with some information on issue with "unable to send data from controller to PC consecutively". I am using STM32L152RC with cubeMX version 6.3.0 and latest firmware version.
2022-05-24 12:39 AM
Hi @Juan.2422 ,
In the package STM32CubeL1, there is already a ready to use CustomHID example. You find it in this path under the package: STM32CubeL1/Projects/STM32L152D-EVAL/Applications/USB_Device/CustomHID_Standalone.
To build your own example with STM32CubeMX, you can refer to this video tutorial.
Please note that latest CubeMX version is 6.5. Please try to align with this one.
-Amel
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.
2022-05-24 01:37 AM
@Amel NASRI I have followed the same video tutorial. I could always receive data from Host PC & also response back to the host using USBD_CUSTOM_HID_SendReport function.
But if micro controller device initiate USBD_CUSTOM_HID_SendReport it is failing.USB device status is either busy or device state suspended. Is there anything i am missing?
I have also tried CubeMX version is 6.5 but no progress.
2022-05-24 09:42 AM
@Piranha I have implemented and tested tiny USB but facing the same issue. I am unable to send data to host consecutively using tud_hid_report().I am calling tud_hid_report() function two times inside tud_hid_set_report_cb() callback method. What i found is ep_state is busy and claimed, so it is not sending data for the second time.
2022-05-24 12:39 PM
> I am unable to send data to host consecutively using tud_hid_report().I am calling tud_hid_report() function two times inside tud_hid_set_report_cb() callback method.
You cannot send data to host before the host receives the previous data and requests you to send again.
No "pushing" data to the host. Design your software based on this.