lpcware

LPC1837 - LPCOpen - MS_Host_SendCommand Stuck - Need Help

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by brunoalmeida on Sun Dec 07 12:04:31 MST 2014
Hello,


  I've been working with LCP1837 for the last 4 months and i've been facing one problem. Sniffing usb communications from OS (Linux, Mac and Windows) i've notice that they send some request with DataLength bigger than the response. The result is that the code get stuck waiting for the endpoint to be ok, and is impossible to answer this request.

One exemple of request is ModeSens6. The linux PC asks for an answer with 192 length (Wireshark Image).

Image - Wireshark

When sending the same request through LPC we simply get no answer back. But directly to the pendrive we receive a answer(Terminal Output Image)

Image - Terminal Output


The code is freezing on MS_Host_SendCommand::MS_Host_SendReceiveData when trying to receive data from pendrive.

Simple command request.

char buffer[192];
MS_CommandBlockWrapper_t wrapper;
wrapper.Signature = 0x43426355;
wrapper.Tag = 0x04;
wrapper.DataTransferLength = 192;
wrapper.Flags = 0x80;
wrapper.LUN = 0;
wrapper.SCSICommandData[0] = 0x1; wrapper.SCSICommandData[1] = 0xa;
wrapper.SCSICommandData[2] = 0x0; wrapper.SCSICommandData[3] = 0x0;
wrapper.SCSICommandData[4] = 0x3; wrapper.SCSICommandData[5] = 0xf;
wrapper.SCSICommandData[6] = 0x0; wrapper.SCSICommandData[7] = 0x0;
wrapper.SCSICommandData[8] = 0xc; wrapper.SCSICommandData[9] = 0x0;
wrapper.SCSICommandData[10] = 0x0; wrapper.SCSICommandData[11] = 0x0;
wrapper.SCSICommandData[12] = 0x0; wrapper.SCSICommandData[13] = 0x0;
wrapper.SCSICommandData[14] = 0x0; wrapper.SCSICommandData[15] = 0x0;
wrapper.SCSICommandLength = 192;

MS_Host_SendSimpleRequest(&Disk_MS_Interface_Host,wrapper, &buffer);
DEBUGOUT("%s ", buffer);

Steps.

1. Initiate one port as Host
2. Enumerate the device on it
3. SendSimpleRequest.

Outcomes