2012-04-09 07:57 PM
Does anyone have a demo / tutorial on how to setup the STM32 USB Library to work with the WinUSB driver. Jan Axelson's ''USB Complete Fourth Edition'' describes how to setup the descriptor, and how to setup the INF file for Windows, but I am not sure what pieces of the USB Library that I need or how to set them up.
#winusb #stm32 #usb2012-04-10 11:07 PM
You really mean this sincerely? Did you ever program anything for USB based from the scratch - I think if you do so, you must be very old already (... a participant of the USB definition spec group perhaps?...) and full of grey hairs ... :).
It would really be VERY helpful, if ST could present a WinUSB demo, e. g. with a minimized Visual C++ application to test the maximum bulk transfer speed in read AND write mode.
2012-04-12 05:36 AM
Well, I guess the answer to my question is that nobody has done this.
I was hoping to be lazy and not ''re-invent the wheel''.2012-04-17 12:03 AM
Use CDC example as a template. There are two BULK endpoints. For better transfer speed CDC example would require small modifications.
1) Change VCOMPORT_IN_FRAME_INTERVAL to lower value. I'm not sure is value = 1 is suitable when transfer needs to be bidirectional, so I've used value = 2. It won't make much difference though. 2) Increase USART_RX_DATA_SIZE. I've used 8192 bytes (2 x 4 kB), but I think that there would be no speed difference with values above 4096 B (maximum number of data would be transmitted in every or almost every frame). 3) Modify Handle_USBAsynchXfer so it wouldn't transmit data unless half of the USART_Rx_Buffer would be full. Thus after each SOF maximum number of bytes would be sent. If there is a change that buffer would be filled with low speed or not filled at all for some time then some kind of timeout would be needed here that would cause transmitting whatever is in buffer already - you may know this problem if you've used USB to UART converters before. On a PC side make sure that application is constantly ready to accept new data. I've used libusb, so I've used combination of usb_submit_async/usb_reap_async to enqueue multiple read requests. I guess with WinUSB that could be made with overlapped I/O. I wasn't interested in high PC to device speed, so I haven't any tips on reverse direction. If you are using STM32F103C8T6 or similar, then source code (CoIDE+gcc) might be helpful. Otherwise better start with clean CDC example - I've removed some code not related to this specific MCU from source code to make it easier to understand.2012-04-18 03:50 AM
Did you check the maximum data rate for direction device to PC?
(I assume you checked only full speed - or did you also test high speed with STM32F4?)2012-04-18 04:29 AM
For a moment I've tested 857 kB/s stream and it seemed stable. I've reverted back to 600 kB/s as higher sampling would require lowering S/H time to 1.5 cycle and I didn't put proper input buffer at ADC so 7.5 cycles were safer for me (ADCCLK = 72 MHz/6).
I don't have STM32F4 (AFAIK separate high speed PHY would be required also), so I've tested only full speed with STM32F103C8T6.2012-04-25 12:28 AM
There is something going on here:
http://searchingforbit.blogspot.com/2012/04/winusb-communication-with-stm32-part-1.html
2012-04-27 12:50 AM
Thank you for this link, looks interesting - but there I find only some very rudimentary / introductory information - no source code or so (also not if I follow the link to the Google code project site). Could you look into the source code?
2012-04-28 11:52 AM
Last post is now only 4 days old.
I think that 3 files athttps://code.google.com/p/found-bits/source/browse/trunk/Sources/Projects/Libs/WinUSBComm/
are what should be the library.There is nothing else besides the WinUSBCommSTM32Demo under projects. I guess it uses the library. I haven't checked it. It is an Eclipse project which I don't use.Also I didn't find the VS sources as depicted in first post.2012-07-17 11:59 PM
Hey guys,
I think this is the answer you're looking for. In this post I attached modified versions of the latest STM32 USB Firmware libraries in such a way that the HID project autobinds the WinUSB driver automatically when you plug it into Windows Vista/7/8.https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DispForm.aspx?ID=23332