LPCOpen USB MSC stalls during write with some drives

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPCOpen USB MSC stalls during write with some drives

1,338 Views
michaelrandle
Contributor II

Several of our products use (one or more) NXP LPC4357 microcontrollers.  Some of them have a USB host implementation on USB0 to allow the user to store and retrieve data on a USB Mass Storage Class device (Flash drive , USB key, external drive, etc).  For the majority of drives this works fine, but there are a number of Sandisk products that enumerate correctly, but fail on the first attempt to write to the drive.

The issue can be reproduced using the following system:

- MCB4300 development board

- LPCOpen v2.20 LPCXxpresso and Keil IAR MCB4357 (Using the Mass Storage Host example application).

- Keil uVision 4

- Sandisk Ultra 16 GB, or Cruzer Switch 16 GB

I know that the libraries and IDE are old, but they are closest to the setup that we have in most of our products, and reflect the development environment that we use in house.  I know that the devices are USB 3.0, but they do work with USB 2.0 hosts on other platforms.

The drives complete the LPC open enumeration without error, but the first time the MS_Host_WriteDeviceBlocks() function is called, the device STALLs the IN endpoint during the Status Transaction stage of the Write command following hundreds or thousands of IN/NAKs.  I've made some changes in EHCI.c to disable the periodic scheduler and limit the NakCount in the Queue head structure for non-interrupt endpoints to four, but this does not change the STALL behaviour.

The version of the LPCOpen library above (the is the most recent one that I could find that actually includes a Host MSC example) does not have an implementation of the HcdClearEndpointHalt() function, so the endpoint remains in a halted state and the Reset Recovery procedure is repeated indefinately.  (I have coded a simplistic implementation for this function, which clears the TD list, terminates the Queue Head TD list and clears the overlay TD's halted flag.  This works, but appears to leave an IN transaction in the Host controller's asynchronous schedule, which I can't figure out how to remove.) 

I have contacted Sandisk technical support, but they cannot provide engineering support because "these drives are not qualified to work with development platforms".

Is there a version of the LPCOpen library that has the STALL recovery mechanism implemented?

Is there a more recent version of the library that works with these drives on a bare-metal implementation?

Any help would be greatly appreciated.

3 Replies

1,079 Views
edouardmalot
Contributor II

Hi Michael,

I have the same issue with 2 SanDisk devices :

 - "SanDisk Ultra USB 3.0 16GB"

 - "SanDisk Extreme GO USB 3.1"

Did you found a workaround ?

Edouard

0 Kudos
Reply

1,079 Views
michaelrandle
Contributor II

Hi Edouard,

No, I do not have a workaround.

The only obvious silicon difference between the NXP EHCI and that of the PC I'm using and the Zylinx micro I have in a different product, is that the asynchronous schedule timeout is 10 us on the NXP and 25 us for the other two.  There is no way to change this timeout on the NXP processor.  The EHCI specification does suggest 10 us, so no criticism of NXP here.  I've tried numerous ways of slowing this down from software, but I don't even know for sure that this is the cause of the STALL condition by the device.

SanDisk responded to my initial query, but could not help at all.  I sent an email to one of the WD OEM team, as suggested by the technical support, but no response yet.

At the moment, it looks like we will need to advise our end users to avoid SanDisk USB sticks.

If I do find an answer, I will post it here.  I hope you have more success finding a solution than I've had so far.

Michael.

0 Kudos
Reply

1,079 Views
edouardmalot
Contributor II

Thank you for your kind answer, I appreciate it.
If I have news, I'll post it here.

Edouard

0 Kudos
Reply