cancel
Showing results for 
Search instead for 
Did you mean: 

Code quality of the USB-Library

tkindler
Associate II
Posted on December 23, 2009 at 08:50

Code quality of the USB-Library

13 REPLIES 13
tkindler
Associate II
Posted on May 17, 2011 at 13:33

Hi!

I'm just trying to integrate the USB library and CDC example into my project. While I like the rest of the standard peripheral library, the USB stuff sucks badly:

* usb_regs.c exports things like ''ToWord'', ''ByteSwap''?! (WTF? They're not even used at all)

* Global variables like pInformation, pProperty, Device_Info, SaveState, but also ''buffer_in'' and ''buffer_out'' (!!)

* #defines in header files with names like ''RegBase''

* usb_type.h is totally redundant:

* duplicates the work of stm32f10x.h (which is included anyways)

* also the types are ''maintained for legacy purpose''..

* includes ''usb_conf.h'' which belongs to application land

And there are lots of other problems that hit you when trying to integrate it into an existing project.

Will there be a cleanup release of the USB library?! It's in a pitiful state, and should really have a code review!

andreas2
Associate II
Posted on May 17, 2011 at 13:33

Yeah, I know, it's crazy! It makes my eyes bleed. I've complained about some of the things you mention, but I doubt it will ever get much attention. Maybe that's for the better, since sooner or later, someone will be forced to rewrite it from scratch.

I have actually got to the point where I started writing my own, but it's only partially complete, might need a few rethinks, and I haven't had time to work on it lately. At least it's powering a DFU-implementation successfully. And it's got an interface that, though not perfect, won't make me want to break things.

tomas23
Associate II
Posted on May 17, 2011 at 13:33

Try to build upon some ST demos with source code, our guys had to deal with that mess, and they did succesfuly.

trevor1
Associate II
Posted on May 17, 2011 at 13:33

I also wrote my own based on the ST code and some code Lanchon posted. Mine is hacked to be OS friendly and I write/read to it in exactly the same way I do for USART based serial ports. It's a pity this isn't an open source project so that we could all contribute and turn this into something better.

tkindler
Associate II
Posted on May 17, 2011 at 13:33

@edison: Well, I feel with you..

ST already went to great lengths with the standard peripheral library (Full Doxygen documentation, nice error checking/reporting, good encapsulation)..

Almost all consumer goods and industrial devices re
16-32micros
Associate III
Posted on May 17, 2011 at 13:33

Dear Friends,

Our USB device Developper Kit is not only a demo but a complete reference Design : It is Fully certified with USB-IF as a complete Framework ( Firmware and Hardware) and adds robustness conditions that you can not find WW. We have put all our USB Knowledge & Quality in terms of Robustness and interoperability tests with all PC Hosts ( OHCI, EHCI, UHCI) running either Windows 2000, XP, Vista ( We passed all woindows Logo Kit programs), Windows7 or Linux or others.

In addition it is already in production ''as is'' with wide customers since 2007.

For Host, This is en end-less story 🙂 { We do not want to have a Free style with source code Library as it is done in the market: I give you one hint : Just ask if these stacks are USB-IF certified ? you will be surprised when going to production to a real Final product } Our strategy is to collaborate with our Partners to provide you the solution that fits your need and is a full-proof solution.

Cheers,

STOne-32.

simko_gyorgy
Associate II
Posted on May 17, 2011 at 13:33

Dear STOne-32 !

My job is to develop a host application which is able to detect a connected device.

I only need to read out the name, PID and VID identification of the connected device.

Best regards

tomas23
Associate II
Posted on May 17, 2011 at 13:33

Few days spent with Linux USB host drivers over the basic host functions from ST library... Good luck, my colleague did it already and it works! :-]

simko_gyorgy
Associate II
Posted on May 17, 2011 at 13:33

Hi edison!

Thank you very much this info.

I wait for the result impatiently. :o