EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

USB Stack

Started by guru March 16, 2006
HI all,

 I am having some doubts. I am new to USB devices.

1.Whether USB stack should be implemented for each type of storage
device or one single USB stack is enough for all the storage devices.
2. Whether Drivers for disk controllers are included within the
operating system or a controller card or we have to write our own.
3. What's the difference b/w USB host stack and USB device stack and
how they will communicate.
4. Whether the USB stack will be different for different hardware
platform. If so for which I need to search?
5. Whether USB drivers and USB stack are same

Thanks

> 3. What's the difference b/w USB host stack and USB device stack and > how they will communicate.
??? Basically everything then. Try http://www.usb.org/developers and http://www.google.com for answers to life the universe and everything. Regards, Richard. http://www.FreeRTOS.org
Hi guru,

your questions are a little too unspecific, so I am not sure if I can 
really help you.

I would strongly encourage you to:
* go to www.usb-by-example.com
   - read the book
* go to www.lvr.com
   - have a look at some sample code
* go to USB.org
   - have a look at the USB specification
   - have a look at relevant USB device class specifications
* go to a chip vendor's site (e.g. Cypress)
   - have a look at a few data sheets

This should give you a good start into USB.

> 1.Whether USB stack should be implemented for each type of storage > device or one single USB stack is enough for all the storage devices.
USB does not only define the basic protocol to exchange bytes between a host and a device, but also so called device classes. There are pre-defined classes for a number of devices. You are probably looking for the mass-storage class. This is a device class defining standard commands for removable media like hard drives, cameras, mp3 players and so on.
> 2. Whether Drivers for disk controllers are included within the > operating system or a controller card or we have to write our own.
drivers for the typical device classes ship with the operating system. That's why you usually don't need to write a driver to access a USB hard drive connected to your system.
> 3. What's the difference b/w USB host stack and USB device stack and > how they will communicate.
USB is an asymmetric protocol. All commands are initiated from the host side. The host handles all the device discovery and enumeration. Therefore the software on the host is much more complex than the software running on a device.
> 4. Whether the USB stack will be different for different hardware > platform. If so for which I need to search?
I am assuming you don't care about the host, as you will probably use a standard operating system with built-in USB support. Talking about devices: You can easily write the device firmware in "C", so that it is portable across different hardware architectures (namely different CPUs and different USB function controllers). You will probably need to adapt the code in order to support your USB function controller. Typical USB chips (e.g. Cypress) come with tons of sample code that you can start with.
> 5. Whether USB drivers and USB stack are same
Depends on what your term "USB stack" really refers to. I would tend to define things like this: - USB stack is the code that discovers and enumerates generic USB devices on the bus - USB drivers are the code that implements standard device classes and plugs into the associated operating system APIs to implement the functionality. This could be drivers for USB audio or USB storage Going from this definition: The answer is clearly *no*. Hope this helps, best regards Felix -- Dipl.-Ing. Felix Bertram http://homepage.mac.com/f.bertram
HI Felix,

Thanks a lot!!

Regards

Guru


The 2024 Embedded Online Conference