This is the mail archive of the
mailing list for the eCos project.
Re: STM32 USB support
- From: Chris Holgate <chris at zynaptic dot com>
- To: Andrew Lunn <andrew at lunn dot ch>
- Cc: Simon Kallweit <simon dot kallweit at intefo dot ch>, ecos-devel at sourceware dot org
- Date: Tue, 19 May 2009 16:44:12 +0100
- Subject: Re: STM32 USB support
- References: <4A11CAAA.email@example.com> <4A11D861.firstname.lastname@example.org> <4A11E5DF.email@example.com> <4A129C34.firstname.lastname@example.org> <20090519120004.GI20046@lunn.ch>
Andrew Lunn wrote:
> The AT91 USB driver has something similar to this. It can configure
> the endpoints by looking at the USB descriptors.
I've just had a quick look back at the AT91, and while there's a certain
degree of flexibility there, it's still limited to the particular
configuration decreed by Atmel as far as buffer sizes, endpoint number
etc. is concerned.
With the STM32, ST seem to have taken the opposite approach - you have a
chunk of buffer memory and 8 endpoint state machines. Beyond that
you've got complete flexibility to choose how many endpoints you want -
input or output (or bidirectional if you don't need double
buffering). You can also choose an arbitrary set of logical (ie visible
to the host) endpoint IDs and buffer sizes.
Given this flexibility, it seemed to be a bit of a waste to define a
fixed standard configuration similar to the Atmel device. Instead, when
the host sends the configuration select to the STM32 EP0 I intercept it
and scan the descriptor data structures for a corresponding
configuration. Using the descriptor configuration I can then set up the
buffer memory and endpoint state machines 'on the fly' to correspond
directly to the configuration requested by the host.
All this gives the application specific driver layered on top of the
STM32 driver complete freedom to specify one or more supported endpoint
> I don't remember how it works with respect to devtab entries.
Since the Atmel and other USB drivers have fixed endpoint
configurations, it's reasonable to statically allocate and configure the
devtab entries during the device init sequence. Unfortunately, this has
obvious problems when using the dynamic configuration scheme described
 I used the bidirectional mode for the control endpoint, but
otherwise decided it was more bother than it was worth!