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

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #45 on: March 07, 2012, 10:59:29 am »
See the SCSI Block Commands spec for complete definitions of the WRITE commands.

If the device accepts the data sent, the command completed successfully.

Jan

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #46 on: March 22, 2012, 02:40:07 am »
Hi  Jan

Am again there to bother you :)
I have written the logic to modify the data being written into the pen drive. However now when i do bulk write operation , I see a lot of frame timing jitter for the SOFs. However I pass the SOFs just as it is without letting it pass through the modification block which could have possibly caused the delay. So I am unable to find out the reason for these jitters.

If you could throw some light on this, I would be really very grateful.

akanksha 

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #47 on: March 23, 2012, 09:45:53 am »
What your firmware does with already received data shouldn't affect SOFs on the bus. So I have no explanation from the information you've provided.

Jan

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #48 on: March 24, 2012, 01:53:34 am »
Hi Jan

Ok Lemme elaborate.

In my previous case , the data coming from the host was stored in a buffer which was eventually read by the USB device.

Now with the intention of modifying the data, the data from the host is stored in the 1st buffer, from where it is read by the modification block. If the data is SOF, IN ,PING, SETUP etc, its just pushed into teh second buffer blindly. However if it is a bulk write data , then teh data is modified and then stored into teh second buffer from where now the data is eventually read by the device.


So now when I have any other class specific request, say read, read format capacity, mode sense, inquiry  etc, or for tht matter all control transfers, the SOFs come perfecly after 125 us.

However When I do bulk write operations, I observe a lot of SOF timing jitters ie SOFs inter gap of less than 125 us (which was not the case prior to addition of the second storage buffer)

However, it does not have any effect on read/ write operations.

So I wanted to know can this cause a serious issue . Also if you could tell me any possibility as to why it is happening.


Akanksha

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #49 on: March 24, 2012, 10:26:45 am »
Where is the buffer? If it's in the device, it shouldn't affect the USB traffic. If it's an external device between the host and the target device, I think it will be difficult to capture the data, modify it, and pass it to the device without timing issues.

Jan

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #50 on: March 27, 2012, 08:18:15 am »
Hi Jan

My next set of queries.

When the HOST issues an inquiry command or read capacity or read format capacity, before that does the HOST itself write that information to the device or this info is provided as one time writable info by the device manufacturer.

Why I am asking this , is while modifying the bulk write data, I observed that the data got modified in the device, However, after that , even though teh free space shown is 14 Gb , I am unable to write any data more than 5 Gb on it. This could obviosuly be due to some memory address being affected.

This really concerns me because according to me whatever info I modify using some logic for bulk write, the same innfo in bulk read , I would extract using the reverse logic. However, the erroneous behavior of the pen drive leaves me with a doubt that is it just the bulk read data which needs to be deciphered or is it also other commands like read capacity , read format capacity etc.


I went through almost all docs available for mass storage devices but could not find any info  regarding this.


So , had to bother you.


Lemme know if I need to clarify further.


akanksha





Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #51 on: March 27, 2012, 10:15:27 am »
The device reports its capacity to the host.

Jan

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #52 on: June 04, 2012, 03:18:56 am »
Hi Jan

Bothering you after a long time with my new set of queries.
Right now I am testing my bridge implementation. However , I wanted to know the reason behind few observations :-

1. For 2 GB of transfer data , the amount of time taken to write into the mass storage device(write operation) is always greater than the amount of time taken to read the same data from the mass storage device(Read operation). eg. if say write takes 12 min, Rea operation takes only 2 min.What could be the reason for such significant time difference?

2. Even while writing the data into the mass storage device, there are soem Read operations which happen along with the expected Write operations. This is once the mass storage device has been detected and the write operation has started. What could be the reason for this?

3. If we copy the contents of the pendrive, back into the pen drive what kind of operation is it ?


Anxiously awaiting your reply.

Regards

Akanksha Jain

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #53 on: June 06, 2012, 09:39:48 am »
A protocol analyzer can show exactly what operations, including what SCSI commands, are occurring and how much time each transaction takes and thus will help you understand what is happening.

Copying contents from and to a pen drive requires reading, then writing.

Jan




akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #54 on: September 14, 2012, 04:54:18 am »
Hi Jan

I am writing in, after a very long time. Presently I am facing some hub related issue. Just to recapitulate, my design acts as a bridge between the USB 2.0 HS Host and USB 2.0 HS device. For the Host , I take direct connection from the motherboard so I never came across any HUBS . Now in some systems(newer ones I guess, usb ports are through an inbuilt hub and )my system probably fails due to this. I went through the USB 2.0 specs but could not significantly find any difference in the basic enumeration cycle in case the transmission happens through a hub.

Even with a Beagle protocol analyser, I could not observe any significant difference. The Chirk-j through direct connection was somewhere around 732 and with hub reduced to 41/42 kind. Other than that , I could not observe anything else.

If I need to modify my design to cater for the HUB incorporation, would the change be even at the data transfer level I mean the control and the bulk transfers or it would be at the basic device enumeration level?

I would be  really thankful if you could please reply to my queries.


Regards
Akanksha
 






Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Regarding USB Mass Storage Device
« Reply #55 on: September 14, 2012, 01:19:33 pm »
What does your device fail to do? You're talking about resets and chirps, does you device not get enumerated at high speed? If you need to debug things like chirps, an Oscilloscope is most useful, so you can see exactly what they look like. A protocol analyser will only signal its presence or absence, and other devices may disagree with this view.

I'm also not sure what your device is, what do you mean when you say its a "Bridge".

akanksha112

  • Member
  • ***
  • Posts: 31
Re: Regarding USB Mass Storage Device
« Reply #56 on: September 18, 2012, 07:51:18 am »
Hi Barry

Yes, my device does not get detected through generic usb hub . However in direct connection between the USB host and the device or through Root hub, everything works fine.
 Before I can proceed  ahead to tell you the problem in detail, there are few things I need to check at my end.

Could you please tell me the basic difference between a root hub and a generic usb hub?
If they are different then for which hub does the hub specific request come into picture?

akanksha

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Regarding USB Mass Storage Device
« Reply #57 on: September 18, 2012, 11:56:32 am »
A root hub performs the function of a hub inside the host. If the device is full speed, an external USB 2.0 hub also converts between full speed (downstream) and high speed (upstream).

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Regarding USB Mass Storage Device
« Reply #58 on: September 18, 2012, 01:23:25 pm »
From a device standpoint the difference between a device attached to a root hub and an external hub should be nothing at all. As Jan mentions if the device is full (or low) speed, the device is now being talked to via split transaction via the hub, so the device will be talking to an EHCI controller, not an OHCI or UHCI controller as it was previously. The timing of transactions can be substantially different, but nothing that a device should not be able to handle.

So the first question, is your device full speed? (or high speed).

As I asked previously, what doesn't work? You've now mentioned "resets", "chirps', and "enumeration". Does you device:

1. get recognized as being attached? (so the host resets it)
2. get successfully reset? (so the host talks to it at the expected speed)
3. fail a subsequent control transaction?

There are lots of things which can go wrong, without knowing at what point your device fails, I couldn't give any advice.

I will say that when we introduced a hub on our motherboard, we didn't see many, if any devices fail. The only enumeration issue I can remember was to do with drive strength settings on the hub, I can't remember the details.