Trying to get a basic USBHID implementation working on a Nucleo WB55RG. I’m using the exact code here. This code instantiates an HID device and creates both input and output interrupt endpoints. I’m able to receive input data (host ← device) but I cannot see output data (host → device).
I don’t know if it is a host issue or device issue. I’m on a Mac using hidapitester to send the output packets. Below is a snippet from the cmd line:
I do not see 1, 2, 3, 4, 5, 6, 7, 8 printed in main(). Any suggestions on what could be happening here? I wonder if my output reports are being sent on the control pipe instead of the output pipe, in which case main() wouldn’t see it. I don’t have an analyzer so not sure how I can verify which pipe it’s being sent on.
I also tried sending packets using python’s hidapi, but am having the same issue. Any ideas on what may be happening here?
As a side note - I’ve found the HID driver a little light weight. Doesn’t look like there is support for feature reports or regular messages sent over the control pipe. Are these features extended anywhere?
I do not understand how your PC saw correct VID and PID because I can not find it in Windows device manager. Then I found there is a mistake in constructor of the official example.
I also found the constructor issue before I did my original post, I forgot to mention that. I was able to see VID/PID no issue, and I’m able to see input reports with no problem. The issue is output reports (host → device), I’m not seeing those. Did that work for you?
I can’t use the python script in the link because it uses pywinusb and I’m using macOS but there is a similar library called hidapi that I tried w/ the same issue (inputs work, but output reports do not work). I’m curious to know if output reports are working for you, if so then it’s probably a host side issue (I’m suspicious that I may be using control instead of interrupt pipe). If it isn’t working for you then at least I can look more into the device driver.
so, I installed that Python’s hidapi and executed a script called try.py via Windows CMD, please see the result bellow.
Windows Terminal:
Opening the device
Manufacturer: mbed.org
Product: HID DEVICE
Serial No: 0123456789
Write the data
Read the data
[8, 7, 6, 5, 4, 3, 2, 1]
[8, 7, 6, 5, 4, 3, 2, 1]
Closing the device
Done
Response from my Serial Terminal connected to ST-link of my Nucleo-F767ZI:
USBHID example
63353500000
Into Mbed’s USBHID example I added this static data (87654321) instead of random from original.
The data what were received are exactly same data like from script try.py .
As a conclusion I can say it is working in my case with my board.
Thanks @JohnnyK - Unfortunately I am still not able to see the output reports. I will continue to troubleshoot. I took a detour and tried it with STM32HAL and it is somewhat working, so I am able to make a little bit of progress.