Author Topic: Regarding USB Mass Storage Device  (Read 59537 times)

akanksha112

  • Member
  • ***
  • Posts: 31
Regarding USB Mass Storage Device
« on: October 21, 2011, 06:45:19 am »
Dear Jan

Please help me out in the issues mentioned below

1. In the Device Manager, my USB 2.0 mass storage device is being detected but with a yellow exclamation mark.

2. In the details tab

Under Devnode flags

I get the following
DN_HAS_PROBLEM
DN_DISABLEABLE
DN_REMOVABLE
DN_NT_ENUMERATOR
DN_NT_DRIVER

The current power state is
D3

It does recognise the hardware and other device instance,compatible and matching device ids.

when I tried plugging in the device to another hst, there the device was successfully detected with power state as D0.

Also there under DevnodeFlags
I observed
DN_DRIVER_LOADED
DN_Started
DN_DISABLEABLE
DN_REMOVABLE
DN_NT_ENUMERATOR
DN_NT_DRIVER

Also if you could throw some light on power state mappings for usb mass storage devices.

Once you tell me about this, I would be in a better position to explain my design problem.

Looking forward to your reply.


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #1 on: October 21, 2011, 09:51:45 am »
It's possible that the host has put the device in the Suspend state because it failed enumeration. A hardware protocol analyzer will show what is happening on the bus. If you don't have an analyzer, use whatever debugging tools you have to monitor the communications on attachment.

Jan

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #2 on: October 24, 2011, 02:27:11 am »
Dear Jan

Thanks so much for reverting. I would now like to elaborate my problem.
Well, I am working on a USB 2.0 Bridge implementation using an FPGA such that any communication between the HOST and the USB Mass Storage Device happens via the USB Bridge. Now I use a Mixed signal Oscilloscope to observe the D+ and D- USB lines of both the device as well as the HOST.Also I am using a Logic Analyser to observe the ULPI interface of the PHY at both host and device end.

My observations :-

1. Oscilloscope observation
   As I plug in the mass storage device, after the initial VBUS steps and full speed pullups and stuff,terminations,I observe the Chirp K signal on the D- line of the device. Then the HOST initiates the KJ sequence after which I have some communication happening on both the sides.
2.After this the chirp K from the device repeats.I assume this is after the device descriptor is read by the HOST and the HOST issues a reset.(Please correct me if I am wrong).Following this there is some more communication happening between the Host and the device. Now the behaviour post this is variable.Sometimes after a little communication, the Chirp K sequence fiollowed by JK from the HOST repeats.Sometimes it does not. After a little communication , the D+ line of the HOST remains high and sometimes USB device is not recognised and sometimes detected with the yellow exclamation mark.



Observations made on the Logic Analyser.

1. The SOF repeating after every 125 us on the HOST as well as the DEvice side
2.18 bytes of device descriptor read with all stages of control transfer successfully happening. Following this a reset happens. After this I have  a Set address happening.
3. Post this I am not able to tweak immediately after Set Address what happens. But eventually I have  a successful Get device descriptor followed by Get Configuration Descriptor,Get String Descriptor, Get Configuration(this  time config followed by interfasce and endpoint).

4. Post this I have been struggling to tweak Set Configuration or even Get Configuration for that matter .But I have not been able to do so as yet.

Now what I wanted to know what is the yellow exclamation mark in terms of enumeration means till what stage has it reached?

Also post Set Configuration do I have the BULK TRANSFERS initaied or before that?

Also if this is some power related issue , could you highlight what could be the problem.

Any help/suggestion from your side is going to help me immensely to channelize in the direction.


Looking forward to your early reply.


PFA the waveforms observed on the USB interface both on teh device as well as the HOST side.


here

yellow D- device
blue D+  device
green D- host
pink D+  host

Please see that the D+ line goes high in the last.

There is one more file which I wanted to attach but cannot do so because of the limited 128 kb size.
Is there any way I acn send it across.Its 160 Kb after compression.


Warm Regards
Akanksha Jain



 




[attachment deleted by admin]

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #3 on: October 24, 2011, 10:18:23 am »
The exclamation point means Windows had a problem communicating. It can be just about anything.

If you don't received Set Configuration, there is likely something the host doesn't like about the descriptors. A hardware USB protocol analyzer will show the traffic on the bus and may offer a clue. If you post the descriptors here, someone might see something.

The host won't use bulk transfers until enumeration is complete.

I've increased the max size of attachments on the forum.

Jan

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #4 on: October 25, 2011, 12:43:50 am »
Dear Jan

As suggested by you, I am mentioning all the descriptors.
Please see if you could figure out something.

DEVICE DESCRIPTOR   :   18 byte device descriptor + LAST TWO CRC -16 BYTES

4B/12/01/00/02/00/00/00/40/64/85/00/10/00/11/01/02/03/01/3D/05


Configuration Descriptor    : 9 byte Configuration Descriptor + crc-16


4B/09/02/20/00/01/01/00/80/FA/E2/FB


String Descriptor               :   + crc 16

4B/04/03/09/04/09/78

Also PFA the waveform with the color conventions same as that mentioned in the previous post.

[attachment deleted by admin]

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #5 on: October 25, 2011, 10:35:53 am »
There should also be endpoint descriptors.

If you want folks to examine the descriptors, you might want to decode them rather than just presenting the raw data.

Jan

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #6 on: October 28, 2011, 02:17:42 pm »
Hi Everyone
I didnt mean to forget it, I am clueless as to how I missed it,because I remember typing it the first.

Anyways here it is

4B    /09/02/20/00/01/01/00/80/FA/09/04/00/00/02/08/06/50/00/07/05/81/02/00/02/FF/07/05/02/02/00/02/FF/C3/29

In one case the last byte of config descriptor is 32 instead of FA but I still get the sameproblem of yellow exclamation mark. I mean I did decode this byte to find out any power related stuff.

Please help me in getting any clue.

Also Jan if you could tell me how would be Beagle USB 480� protocol analyzer for debugging my problem? Any other protocol analyser you would like to suggest? Actually I cannot initiate the purchase of some expensive one at this juncture so please if you could tell some good one in an affordable range. I would be really grateful to you.

Other than  that if you could download the snapshot of the USB lines I had posted, the HOST D+ line goes high and the detection goes for a toss.I deally when the device is successfully detected what is state of the USB lines both on the Device and the HOST side.


One more query which i had was hwhat happens after Set Configuration request being successfully carried out? I mean post this what are teh steps in the device enumeration? When does the device start receiving the class specific requests?

Sorry for writing in late.

Looking forward to your reply anxiously!!!

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #7 on: October 28, 2011, 06:38:55 pm »
The host is detecting the device. Otherwise it wouldn't attempt to enumerate it.

When the device returns ACK to a Set Configuration request for a configuration > 0, enumeration is complete.

I have links to protocol analyzers here:

http://www.lvr.com/development_tools.htm#analyzers

The Beagle and Ellisys are good. I haven't used them all.

To find any problems in the descriptors, you need to decode them to verify that you are using the values you intended.   

Jan


akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #8 on: October 29, 2011, 12:41:27 am »
Hi Jan

Thanks for reverting.

"To find any problems in the descriptors, you need to decode them to verify that you are using the values you intended.  "
Could you please elaborate on this.I did not get you.

Akanksha


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #9 on: October 29, 2011, 12:04:15 pm »
You posted the descriptors as hex codes. To look for errors in the descriptors, it's helpful to list each code and its meaning. For example:

12 descriptor length
01 descriptor type - device

etc.

Jan

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #10 on: October 31, 2011, 12:48:47 am »
Hi Jan

I also wanted to know when does the HOST start sending the Class Specific Request? I mean is it immediately initiated after Set Configuration Request?

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #11 on: October 31, 2011, 01:29:00 am »
Hi Jan

DEVICE DESCRIPTOR   :   18 byte device descriptor + LAST TWO CRC -16 BYTES

4B    DATA1 PACKET 
   
12     -   bLength       18 BYTE DESCRIPTOR

01     -   bDescriptorType    --   device descriptor type

00     -   bcdUSB


02     -   bcdUSB

00   -    bDeviceClass


00    -  bDeviceSubClass


00    -   bDeviceProtocol


40    -  bMaxPacketSize0   64 BYTES


64    - idVendor


85    - idVendor


00   -  idProduct


10   -  idProduct


00   -  bcdDevice

11   - bcdDevice

01   -  iManufacturer

02   -  iProduct

03 -  iSerialNumber

01 -   bNumConfigurations
3D   -  CRC
05   -   CRC

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #12 on: October 31, 2011, 01:38:06 am »
  Configuration Descriptor


Configuration Descriptor    : 9 byte Configuration Descriptor + crc-16


4B   data1 packet

09     bLength  9 byte descriptor


02    bDescriptorType   Configuration descriptor


20     wTotalLength    ( Total length of data returned for this
configuration. Includes the combined length
of all descriptors (configuration, interface,
endpoint, and class- or vendor-specific)
returned for this configuration.
)



00   wTotalLength


01   bNumInterfaces
 

01   bConfigurationValue


00   iConfiguration


80      bmAttributes(Configuration characteristics

D7: Reserved (set to one)
D6: Self-powered
D5: Remote Wakeup
D4...0: Reserved (reset to zero)
D7 is reserved and must be set to one for
historical reasons.
A device configuration that uses power from
the bus and a local source reports a non-zero
value in bMaxPower to indicate the amount of
bus power required and sets D6. The actual
power source at runtime may be determined
using the GetStatus(DEVICE) request (see
Section 9.4.5).
If a device configuration supports remote
wakeup, D5 is set to one.
)


FA   bMaxPower

E2    crc

FB   crc

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #13 on: October 31, 2011, 01:44:55 am »
 

STRING DESCRIPTOR


4B    DATA1 packet

04   blength   ie 4 bytes

03    bdescriptor type is   String Descriptor 

09      Wlang ID     LSB byte

04      Wlang ID   MSB byte     --   Supported Language Code Zero  US English

09   CRC

78    CRC

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #14 on: October 31, 2011, 02:11:54 am »
Complete Configuration Descriptor:    9+9+7+7= 32 byte descriptor  + crc 16

4B    DATA1 PACKET

09     Blength   ie 9 bytes of config desc

02      desc type  ie Config Descriptor

20    wTotalLength

00    wTotalLength

01    bNumInterfaces


01    bConfigurationValue



00    iConfiguration

80     bmAttributes

FA    bMaxPower



09   blength ie   9 bytes of Interface desc

04   bDescriptorType   interface Descriptor Type


00   bInterfaceNumber


00   bAlternateSetting


02   bNumEndpoints


08   bInterfaceClass


06     bInterfaceSubClass


50   bInterfaceProtocol


00   iInterface
07   Endpoint Descriptor

05   bDescriptorType   ENDPOINT Descriptor Type


81   IN ENDPOINT WITH ENDPOINT NUMBER 0001


02   bmAttributes     Bulk endpoint  with no synchronization



00   wMaxPacketSize



02   wMaxPacketSize


FF    bInterval

07   Endpoint Descriptor

05   bDescriptorType    ENDPOINT Descriptor Type

02     out endpoint with endpoint number  02

02   bmAttributes     Bulk endpoint  with no synchronization

00   wMaxPacketSize


02   wMaxPacketSize


FF   bInterval


C3   CRC
29   CRC