Author Topic: USB MSC Test failure but OK in normal operation  (Read 11058 times)

MartinJK

  • Member
  • ***
  • Posts: 5
USB MSC Test failure but OK in normal operation
« on: November 12, 2010, 01:41:11 pm »
My MSC class implementation tries to transfer 4K at a time from the mass storage media and then send it to the host*. This works fine normally, with Windows requesting up to 64K at a time for contiguous clusters. The class will alternately read 4K from the media and send it to the host repeatedly until all required data is sent. As I say, with Windows this is fine, but the USBCV2.0 compliance checker invariably hits its NAK timeout limit on the IN endpoint on the second block and that is even for the 8K test parameter. The only way to pass the tests is with a 512 byte buffer so the read-media-write-endpoint loop is executed many more times. This behavior is observed with both a RAM disk and a NAND Flash implementation so speed of access does not appear to be the issue.

Has anybody seen this sort of problem and, if so, is there a way around it. Can the dCSWDataResidue value be used in some way to tell the host to hold off while I get the next batch of data? Is stalling the endpoint the way to go, followed by a CSW with a non-zero dCSWDataResidue value? If so, is the bCSWStatus set to 0x00 or 0x01?

* By the way, the USB controller I am using can transmit mutliple packets at a time using DMA.

Thanks for any assistance anyone can offer.

Martin

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB MSC Test failure but OK in normal operation
« Reply #1 on: November 14, 2010, 10:57:35 am »
How long is the NAK timeout? If I recall correctly, the mass-storage spec doesn't specify timeouts.

Jan

MartinJK

  • Member
  • ***
  • Posts: 5
Re: USB MSC Test failure but OK in normal operation
« Reply #2 on: November 15, 2010, 08:26:16 am »
For read, the first dialog box that shows states 28s; for write, it shows 8s. I agree with your statement re the spec, but if a manufacturer requires certification (as is the case with one of our customers just now) they must, surely, pass the USBCV MSC tests which does have a timeout.

Do you know of any way that I can hold off the host until data is ready other than with the NAK?

Thanks
Martin

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB MSC Test failure but OK in normal operation
« Reply #3 on: November 15, 2010, 09:35:15 am »
28 seconds is a very long time. Why is the endpoint NAKing for so long?

Jan

MartinJK

  • Member
  • ***
  • Posts: 5
Re: USB MSC Test failure but OK in normal operation
« Reply #4 on: November 15, 2010, 09:50:26 am »
I have no idea!

Martin

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB MSC Test failure but OK in normal operation
« Reply #5 on: November 15, 2010, 05:27:56 pm »
I would start by looking for the reason for the long delay. It shouldn't take a device 28 seconds to respond to a request.

Jan