2016-11-14 11:52 AM
I needed to make a basic bulk device, so the natural starting point appeared to be a CubeMX generated CDC project. Really, I was stunned by the number of custom files generated:
usb_device.h usbd_desc.h
usbd_cdc_if.h
usbd_conf.h
usbd_cdc_if.c usbd_conf.cusb_device.c usbd_cdc_if.cusb_desc.cAfter much effort, I finally achieved the result I wanted, but I really think this templating thing has gone too far. Furthermore, some of the generated files are virtually empty while others have a lot of stuff that needn't be customized. Consider usbd_conf.c -- 536 lines of code. There are only a few procedures in this that need to be customized --LL_Driver_Init (where the endpoints are created -- btw, in the generated code these are hardwired constants rather that the defined names created in the header files), USBD_static_malloc and USBD_static_free. Could you please reconsider this architecture ? It should be enough to touch a few relatively clean files to create a custom USB configuration. Obviously the descriptors and endpoints, but most of the rest should be pretty much common. As things stand, I wouldn't recommend using the CubeMX generated code as a starting point for USB devices.Geoffrey .ExternalClassFD6DE0CE53924DB0853762530284C4FB p.p1 {margin:0.0px 0.0px 0.0px 0.0px;font:13.0px Menlo;background-color:#ffefd5;} .ExternalClassFD6DE0CE53924DB0853762530284C4FB span.s1 {;} .ExternalClassFD6DE0CE53924DB0853762530284C4FB span.Apple-tab-span {white-space:pre;}2016-11-29 04:44 AM
Hi Geoffrey,
Thanks for sharing your feedback.We review it internally, and will come back to you as soon as possible.-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.
2016-12-09 02:01 PM
I'm also finding it challenging to figure out how to create a simple 'custom class' with a bidirectional USB bulk transfer pipe. I'm trying to wrap my brain around
http://www.st.com/resource/en/user_manual/dm00108129.pdf
- it's difficult to understand how all the modules interact, and what I do and don't need to customize.It would also be helpful if you also provided sample code to setup something like this, to exchange arbitrary data with a host using WinUSB.
2016-12-09 02:14 PM
Brown.Geoffrey
,After much effort, I finally achieved the result I wanted
Can you offer any hints, as I'm trying to do the same thing?
2016-12-09 03:10 PM
I've the WinUSB forF407, not sure it still works, but you can give it a try, if you want to...
Renegade
2016-12-09 08:10 PM
Here's a github repository of a basic bulk usb example:
https://github.com/geoffreymbrown/stm32usb-bulk
It's just a simple echo program. I did include two test programs that use libusb-1.0. One that lets you send text (and see the echo) and another that gives some basic endpoint information. I don't do windows, so I can't help with winusb. This was a bit slapped together, so I won't make any guarantees for either the functionality or code quality
2016-12-12 11:41 AM
Looks like you're not using ST's USB library...?
Also, how do I open that as a project? I'm not familiar with GPDSC files. It's associated with Keil uVision on my Windows 10 PC, but uVision doesn't seem to know what to do with it.
2016-12-12 11:41 AM
Where would I find that? (I did look; haven't found it yet.)
2016-12-12 11:46 AM
I did use the USB library, but there’s no built-in class for bulk transfer. GPDSC is one of the options for output from CubeMX. There’s also an ioc file so you could use cubemx to generate whatever project files Keil needs. I don’t use an IDE so I can’t help you with that.
Geoffrey