Help for Mass Storage Host

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

Help for Mass Storage Host

1,968 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Marco72 on Mon Nov 14 22:53:13 MST 2011
Hi , I am studying the mass storage host example.
My enviroment is LPCXpresso v4.0.5 [Build 123] + LPCXpressso LPC1769 REV B, plugged on a breadboard where is the USB connector ( and some resistor as for some examples found on LPCXpresso support forum).
The lib is "nxpUSBlib v0.90 beta"

I have 3 USB memory key, 2 of them work without errors but one not work.

The not working naturally works plugged to PC.

Debugging I found that the program remain always locked in WaitForTransferComplete function when this function is called within MS_Host_RequestSense because of calling EVENT_USB_Host_DeviceEnumerationComplete.

So the enumeration happen but there is a problem in "sense requesting".

Thank you very much for any help to understand what happen.

Ciao

Marco

Labels (1)
0 Kudos
Reply
10 Replies

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hahoangthach on Sat Nov 19 08:14:05 MST 2011
You're dead right. Windows's driver is good & old enough to go around that, the usblib is still in beta phase and it needs as many feedbacks as possible just like you do to mature. It is better if you could file a issue in the bug-tracker together with screen shot, diagnostic messages, and information about the thumbdrive (use the UVCViewx86 program, you're gonna need it to develop any usb-related products) etc.... Hopefully, nxpUSBteam or other members can make a patch soon enough.
0 Kudos
Reply

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Marco72 on Fri Nov 18 23:01:26 MST 2011
noted, thank you
0 Kudos
Reply

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Marco72 on Fri Nov 18 22:59:02 MST 2011
. surely on the market there are a lot of thumbdrives and perhaps an embedded host will never be compatible with all of them
but in these case the error need to be reported to user.
Why in PC hosts this do not happens? Is it because use a different host than OHCI ?

. during my tests sometime multiple LUN was sporadically reported (10 LUN instead of 1).







0 Kudos
Reply

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hahoangthach on Fri Nov 18 01:03:00 MST 2011
as far as I can dig,
The error occurs at line 408 in the OHCI.c and its error code is 4 in HCD_STATUS enum which is HCD_STATUS_TRANSFER_Stall. So as I guess, your usb thumbdrive somehow sends stall when responding the Request Sense command. The rest could be the consequences.

PS: last time, I work on a project featuring mass storage host. The QA labs tests with more than 100 devices and each of them has all kinds of issue from timing, multiple LUN, some even expects some weird commands to work.
0 Kudos
Reply

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxpUSBlib team on Thu Nov 17 15:28:56 MST 2011
nxpUSBlibConfig.h is new to nxpUSBlib v0.91 beta. Perhaps you can upgrade to this latest version?
0 Kudos
Reply

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Marco72 on Thu Nov 17 13:46:39 MST 2011
Sorry but,

- nxpUSBlibConfig.h I cannot find this file in nxpUSBlib
- using the flag NXPUSBLIB_DEBUG (adding the symbol in nxpUSBlib project bulild configuration)

I get
----------------------------------------------
8 times

OHcdDataTransfer
../Drivers/USB/Core/LPC/HCD/OHCI/OHCI.c: 408
Evaluated HCD_STATUS = 4

then this 3 messagese repeated for ever

QueueOneGTD
../Drivers/USB/Core/LPC/HCD/OHCI/OHCI.c: 704
Evaluated HCD_STATUS = 23
QueueGTDs
../Drivers/USB/Core/LPC/HCD/OHCI/OHCI.c: 719
Evaluated HCD_STATUS = 23
OHcdDataTransfer
../Drivers/USB/Core/LPC/HCD/OHCI/OHCI.c: 398
Evaluated HCD_STATUS = 23

-----------------------------------------------

I am going to deep-debug and buying some books about USB devices.
Thank you for further suggestions


0 Kudos
Reply

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hahoangthach on Tue Nov 15 22:30:05 MST 2011
my bad, I see there is a debug flag for the usblib called NXPUSBLIB_DEBUG, look like it prints error message inside the lib.
Try to define the symbol NXPUSBLIB_DEBUG for nxpusblib project (in the build configuration or nxpUSBlibConfig.h) and paste the message here. I think your device stall the pipe somewhere in the middle
0 Kudos
Reply

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxpUSBlib team on Tue Nov 15 18:36:19 MST 2011
It may not have anything to do with your problem, but we are using a more recent version of the IDE, version 4.1.0 build 190. Can you update to this latest version of the tool? Again, it may not make a difference, but it will eliminate one variable in this equation.
0 Kudos
Reply

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Marco72 on Tue Nov 15 11:43:02 MST 2011
Thank you hahoangthach,

unfortunately after commenting as you suggest none of the 3 usb keys works.

The positive thing is the fact that all fail in a "Error retrieving device sense". So the one that previously remained locked now exits with error.


Ciao

Marco
0 Kudos
Reply

1,855 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hahoangthach on Tue Nov 15 01:36:00 MST 2011
This sounds like a device-related issue. I guess your device doesn't expect the ResetMSInterface command.
Please try to comment that out as follows

<code>/*if (MS_Host_ResetMSInterface(&FlashDisk_MS_Interface))
{
puts_P(PSTR("Error resetting Mass Storage interface.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_Host_SetDeviceConfiguration(0);
return;
}*/

SCSI_Request_Sense_Response_t SenseData;
if (MS_Host_RequestSense(&FlashDisk_MS_Interface, 0, &SenseData) != 0)
{
puts_P(PSTR("Error retrieving device sense.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_Host_SetDeviceConfiguration(0);
return;
}
</code>
0 Kudos
Reply