1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Looking for USB stack with permissive licence (mass storage)

Discussion in 'Embedded' started by Noob, Apr 3, 2012.

  1. Noob

    Noob Guest

    Hello everyone,

    I work for a small set-top box manufacturer. Our boxes have
    a 450-MHz SH-4 CPU and typically 128/256 MB of RAM, running
    a proprietary RTOS.

    At the moment, we are using a proprietary third-party USB stack,
    which is mostly a binary release. The source code I do have is
    of fairly low quality... :-(

    I'm looking for an open source USB stack which would be easily
    ported to an SH-4 platform with an RTOS.

    I've just finished integrating lwip, and it was a great experience.
    The documentation is a little lacking, but they've managed to make
    porting very clean, with a clear separation of arch files, and core

    Would such a beast exist for USB?
    I only need the mass storage class.

    I did stumble upon LUFA, but it seems very AVR-specific.
    (Although it seems to have been ported to ARM recently.)


    Are there other options out there?

    Noob, Apr 3, 2012
    1. Advertisements

  2. Noob

    Tim Wescott Guest

    You might try these guys:


    Not open source, but when I integrated uC/OS-II into a product they were
    very cost-effective and supplied nicely compilable source code.
    Tim Wescott, Apr 3, 2012
    1. Advertisements

  3. Noob

    David Brown Guest

    If you don't need maximal speed, then maybe you can use something like


    There is firmware available for these chips for USB mass storage device
    interfacing, amongst others.

    It would mean another chip on the board - but no royalties and probably
    easier development.
    David Brown, Apr 4, 2012
  4. Noob

    Noob Guest

    [Picture of a home-built aircraft]

    I don't understand.
    Do you have a link? How long have they been selling their USB stack?

    Noob, Apr 4, 2012
  5. Noob

    Noob Guest

    USB 2.0 "Hi-Speed" mode is 480 Mbit/s. My goal is 30 MB/s (240 Mbit/s)
    of "useful" bandwidth (i.e. considering actual data transferred only).
    IIUC, the overhead in the USB protocol is fairly significant.
    Hmmm... The chipset we use provides its own USB controller, and the
    board layout has already been validated. I don't think it is an option,
    at this point, to add a new chip. Which is why I'm only looking for a
    software (USB2) stack. I only need support for the mass storage class
    and bulk transfers (don't know if the other transfer modes are required
    for normal operation).

    I find it strange that there are very good TCP/IP open source libraries,
    but that I can't find a portable, open source USB stack for embedded
    systems with "powerful" CPUs (powerful compared to micro-controllers,
    i.e. roughly equivalent to the first Pentium III variant Katmai.)

    I'll try looking harder. I encourage everyone to jump in the fray
    if you know something that might prove useful.

    Noob, Apr 4, 2012
  6. Noob

    Tim Wescott Guest

    Whoops! That was supposed to be a link to the Micrium website -- they're
    the folks that do Micro-C/OS-II (and -III).


    As I said, I had good experiences with them 10 years ago; it's a nice
    little OS, but we didn't use any of their add-on stuff.

    Should you decide to build a plane in your spare time, the Piet is
    certainly popular (if slow), and you can still get rebuildable Model A
    engines fairly cheap if you want to be nostalgic -- but that has nothing
    to do with what you asked.
    Tim Wescott, Apr 4, 2012
  7. Noob

    Rob Gaddi Guest

    Have you tried pinging your local Renesas FAE? They might have app
    notey sorts of things with already working code.
    Rob Gaddi, Apr 4, 2012
  8. Noob

    Tim Wescott Guest

    Have you checked with your chipset vendor to see if they've got support?
    I see more and more chips coming out with on-board IP to run their
    Ethernet or USB ports stashed away in ROM someplace.

    Of course, you're then depending on code that's written by a group of
    people who are viewed as an "expense" by company bean-counters. But you
    might luck out.

    My liberal friends think I'm a conservative kook.
    My conservative friends think I'm a liberal kook.
    Why am I not happy that they have found common ground?

    Tim Wescott, Communications, Control, Circuits & Software
    Tim Wescott, Apr 4, 2012
  9. That seems to be a pretty ambitious target. Where is all that data
    going to go (or come from)? Do you want that rate in continuous
    transfer, or only in bursts? Given the overhead and the possibility
    of other USB traffic, that seems a lot to ask.
    Are you doing high-speed transfers now? Do you get anything like
    The variations in USB peripherals may be larger than that for Ethernet
    controllers. In addition, Ethernet and TCP/IP are ancient when
    compared to USB 2.0.
    Mark Borgerson
    Mark Borgerson, Apr 5, 2012
  10. Noob

    Noob Guest

    I can live with 20-25 MB/s ;-)
    A recent 3.5" HDD in a USB2 enclosure (nowadays, 3.5" HDDs
    sport 64 MB of cache, and can sustain 50 MB/s over SATA)
    The worst-case scenario (in terms of required performance)
    recording (writing) 4 HD programs (say 4x20 Mb/s) while
    playing one back (20 Mbit/s).

    I.e. 100 Mbit/s (12.5 MB/s) of continuous bandwidth.
    Being able to sustain bursts at 30 MB/s would minimize
    time spent waiting for the bus.
    What other USB traffic?
    With the current stack, I've measured 18-20 MB/s sustained.
    But there are a lot of unnecessary copies because whoever
    ported the library was clueless about cached/uncached memory
    zones and DMA.
    Noob, Apr 5, 2012
  11. Noob

    Noob Guest

    The chipsets are from ST. They do provide TCP/IP and USB stacks but
    only as (expensive) options (high up-front cost + per-unit fees).
    My bean-counters have deemed these costs unacceptable :)

    Which is why I've integrated the BSD-licensed lwip TCP/IP stack,
    which is quite adequate. I was hoping to find the same quality
    of software in an free USB stack.
    Open source is here to stay. Companies that do not provide source
    code need to die a quick death.
    Noob, Apr 5, 2012
  12. Noob

    Noob Guest

    Do you think I can contact Renesas for ST gear?

    The only thing I want to do with the ST support team
    involves voodoo dolls and large needles.
    Noob, Apr 5, 2012
  13. Noob

    Paul Guest

    Might be lucky.
    SATA is 1.5Gbps max burst speed

    SATA II is 3Gbps

    SATA is point to point not daisy chain/star or other type of BUS
    USB is basically a polled bus with time slices. Even with ine device you
    have root and management after enumeration etc.

    Let alone talking to end points for each block transfer continuous or
    burst. And of course files system handling.
    May well be best you get with USB.

    Ever considered SATA( or II) or eSATA( or II) may be easier
    Also allow any size mass storage, just have many filesystems to support.

    Paul Carpenter |
    <http://www.pcserviceselectronics.co.uk/> PC Services
    <http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font
    <http://www.gnuh8.org.uk/> GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
    <http://www.badweb.org.uk/> For those web sites you hate
    Paul, Apr 5, 2012
  14. Noob

    Paul Guest

    Well easy mistake to make as SH-4 architecture also sold by Renesas
    (ex Hitachi division). May still be worth looking at their app notes

    Paul Carpenter |
    <http://www.pcserviceselectronics.co.uk/> PC Services
    <http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font
    <http://www.gnuh8.org.uk/> GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
    <http://www.badweb.org.uk/> For those web sites you hate
    Paul, Apr 5, 2012
  15. That's fine for SATA. Have you measured the sustained throughput
    with USB?
    That sounds like a good recipe for disk thrashing. What kind
    of file system are you planning to use on the HDD? If it's
    FAT32, how will maintaining the FAT for 3 files being written
    affect your throughput? If it's a large disk, caching the
    whole FAT could use up a lot of your RAM.
    Since you hadn't specified a dedicated HDD at that point, I had
    to ask.
    To what degree is the throughput constrained by the HDD and file
    system and not the unnecessary copies?
    And just when you thought USB 2.0 was good, there are now HDDs comming
    out with USB 3.0 interfaces! ;-)

    Mark Borgerson
    Mark Borgerson, Apr 5, 2012
  16. Noob

    Noob Guest

    A USB stack (even one limited to mass storage) is not what I would
    call trivial software. I'm not sure what to expect from app notes.
    Is it common for chip makers to provide full software stacks with
    their app notes?

    Noob, Apr 16, 2012
  17. Noob

    Noob Guest

    "With the current stack, I've measured 18-20 MB/s sustained."
    But this stack was compiled with gcc -O0, with message queues
    re-implemented using interrupt masking (!!) instead of using
    the OS implementation, with bounce buffers used everywhere,
    and every dynamic memory block allocated from an uncached
    memory pool.
    FAT sucks. We use ext2 with large blocks.
    Seriously? Modern HDDs can sustain 100+ MB/s sequential R/W on the
    outer tracks, 50+ MB/s on the inner tracks. Whatever is the bottle
    neck, it's not the HDD.
    I don't think the higher bandwidth of USB 3 brings anything
    to the table for a PVR product. Can one plug a USB3 enclosure
    into a USB2 port?

    Noob, Apr 16, 2012
  18. Noob

    Stef Guest

    In comp.arch.embedded,
    I don't know if its 'common', but Atmel did supply a working mass storage
    example for their SAM7S controllers.
    Stef, Apr 16, 2012
  19. Noob

    Arlet Ottens Guest

    If you strip it down to a point where the host only works with a single
    mass storage device, without a hub, and you don't worry about current
    consumption, suspend mode, or isochronous endpoints, it's not that hard
    to make a USB stack. The app notes I've seen are not much more than this.
    Arlet Ottens, Apr 16, 2012
  20. Noob

    Stef Guest

    In comp.arch.embedded,
    Whoops, I think missed hte 'host' part somewhere. The Atmel example is
    device only, sorry.
    Stef, Apr 16, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.