Author Topic: Confused about how a USB Composite Device it put together...  (Read 13160 times)

st2000

  • Member
  • ***
  • Posts: 44
Confused about how a USB Composite Device it put together...
« on: January 11, 2011, 07:29:37 pm »
Hi...

I am confused about how a USB Composite Device is put together.  I had read that a Composite Device is made up of 2 or more Interfaces.  And each Interface contains End Points that the USB Host can connect to using Pipes.

But, as I step through some code from Microchip for their PIC processors, I only see evidence of a single Interface in what I thought was a Composite device.

I say it is a Composite device because when I connect it to a Linux system I see two MSDs.  One of which is FAT formatted and gets auto mounted.

So I thought I would start out by asking if my impression of what a Composite device is is accurate.

-thanks


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Confused about how a USB Composite Device it put together...
« Reply #1 on: January 11, 2011, 07:56:51 pm »
A composite device has multiple, independent interfaces. You should be able to see them in the descriptors file of the source code.

Jan

st2000

  • Member
  • ***
  • Posts: 44
Re: Confused about how a USB Composite Device it put together...
« Reply #2 on: January 11, 2011, 08:14:43 pm »

A, there's the rub.

I don't have the source code of the USB PERIPHERAL device.

I was stepping through the (Microchip Solutions) PIC code of my USB HOST device.  There I found evidence it read back from the USB PERIPHERAL device a description that only had 1 Interface!  But I know when I plug this USB PERIPHERAL device into my computer there are two MSDs in it.

I assume, I can ask all the questions I want of the engineer assigned to the USB PERIPHERAL device.  Right now I've an email out to him asking for the USB Descriptor / Setup being used.  I am hoping that will tell me what to look for when programming my USB HOST device.

In the mean time I thought I'd ask here to see if this mess was on account of an incorrect assertion on my part.

So you agree ... the Microchip Solutions software should pull information from the Zero-End-Point of this "Composite" USB device that essentially says it has 2 Interface.  That is, an Interface for each MSD.

-thanks


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research

st2000

  • Member
  • ***
  • Posts: 44
Re: Confused about how a USB Composite Device it put together...
« Reply #4 on: January 11, 2011, 10:14:15 pm »
Yes, I know about that thread - I started it - I was asking about talking to two MSDs in one composite device.  It turns out the PIC / Microchip Solutions software  (by default) talks just fine to the 1st MSD.  I'll post a follow up to explain this over there in order to help out others who follow that thread.  What I wanted to do here is explore how to access the second MSD.  I feel it should be easy if only I understood how a composite device was represented to the PIC HOST running the Microchip Solutions software.  I really believe it is a matter of re-writing the Microchip Solutions software such that it uses the second USB Interface on the composite device.  But, as far as I can tell, the USB PERIPHERAL device is only reporting 1 Interface.

-thanks

st2000

  • Member
  • ***
  • Posts: 44
Re: Confused about how a USB Composite Device it put together...
« Reply #5 on: January 12, 2011, 10:49:17 pm »
Follow up...
(I hate when people don't do this.)
I was able to access the 2nd MSD.  But I am confused about why it works.  Perhaps I don't really have a composite USB device.

What I did: In the Microchip USB MSD drivers, I located a function (method) which is supplied a LUN number from the calling routine.  In all cases that value is hard coded to zero.  For a quick fix, I forced the LUN number in the called function to one. Now the rest of the Microchip drivers can access the FAT formatted SDCard inside this USB device.

What I am confused about:  I took a close look at the descriptor the Microchip code pulled from the USB device.  It was only 0x20 bytes long.  I could only find 1 interface description.  And only 2 end points.  An input and an output.  Obviously there is no indication of a 2nd MSD here.

So what is a LUN within the context of a USB devices?  How does a LUN relate to an Interface?  Or an End Point?  Do I have a composite USB device here?  Or is it something else?

-thanks

Bret

  • Frequent Contributor
  • ****
  • Posts: 68
Re: Confused about how a USB Composite Device it put together...
« Reply #6 on: January 13, 2011, 03:31:33 pm »
LUNs don't have anything to do with USB.  For MSDs, USB simply provides the physical transport, but the protocol used to communicate with and control the device itself is almost always SCSI.  The SCSI "layer" is where LUNs come into play.

Probably the easiest example of this to understand are the USB multimedia card readers, which usually have four slots in them to plug in different kinds of media (SD, MMC, CF, etc.).  These usually have just one USB interface with two USB end points (though some may also add a third interrupt end point), but have four LUNs at the SCSI level (each physical slot is a separate LUN).

Another example are flash drives with U3 software installed.  These have two LUNs: a CDROM LUN where the U3 software is installed (set up as a CDROM so the U3 software can AutoRun in Windows), and a second LUN (DASD, not CDROM) for actual data storage.