AnsweredAssumed Answered

Question regarding STM32F0x2_USB-FS-Device_Lib

Question asked by Kraal on Sep 23, 2016
Hello everyone,


I have some questions regarding the F0 USB Library made by ST and USB HID.
I am using a STM32F042 with the standard peripheral library (I don't want to hear about Cube) and the F0x2 USB device library, as I want to make a simple custom HID device.


Regarding the HID:
I want to use interrupt endpoints, 1 for IN and the other for OUT. So in my interface descriptor I should specify that I have 2 endpoints, and in each endpoint descriptor specify the endpoint address and direction. In my case 0x81 for IN and 0x01 for OUT. If I understand well, for the host they are two distinct endpoints. But what about my device ? Since the endpoint number is the same (0x01), is it 1 or 2 endpoints ? This will be reflected on the value of EPNUM in the library, which is endpoint 0 plus the rest of endpoints (so in our case EPNUM = 2 or 3).


Regarding the library:
How can I know when the device has been successfully enumerated and ready to use ? And also when it has been disconnected ?
One more thing, when my device is in DFU bootloader mode (the bootloader in ROM), windows recognize it immediately (I hear the USB sound immediately). But if my device is in HID mode (my firmware), the USB sound comes 2 to 3 seconds later. Is it because I'm using the HSI48 with CRS correction on SOF events ?


Last question: what would be the best utility on windows to get the USB flow between the PC and my device ?


Have a nice day,
Kraal

Outcomes