Problem USB Massstorage

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

Problem USB Massstorage

419 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Patrick_W on Wed Dec 30 02:05:20 MST 2015
Hey Guys,

first to the specs:
i am working on Win 7 with LPCXpresso V7.6.2. The used processor is a LPC1769.
For the USB communication i use the LPCUSBLib v.098.

My target is to generate a "virtuel" Massstorage Device on the internal RAM.
This works so far that the Device shows up under Windows. If i open the Device it also shows the three files i generated on the device.
The files got a Size of 512B (which is although correct).

The Problem is when i open the Device it runs into an endless loop. The while-loop is located in Endpoint_Read_Stream_LE

I think this topic is about the same problem:
https://www.lpcware.com/content/forum/lpc1769-usb-cannot-write

Has somebody an idea what could be the problem?

I wish a happy New Year.

Best regards
Patrick
Labels (1)
0 Kudos
5 Replies

394 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Patrick_W on Tue Jan 12 00:55:11 MST 2016
Update: This hasn't solved the problem. The defined 2 is correct because it defines the logical
EP. The physical is then calculated in the configuration function.
0 Kudos

394 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Patrick_W on Wed Dec 30 07:12:06 MST 2015
I tried to solve the Problem by using the function Endpoint_Streaming. The result is nearly the same (Device shows up, files look okay), but now i stuck in the following while loop:
while(!Endpoint_IsReadWriteAllowed());

So i checked the Endpoint defines. For the IN Endpoint there is nr. 5 defined (Bulk In, manual page 224).
The OUT Endpoint is defined as nr. 2 (Interrupt Out, manual page 224).

Is this the right configuration? Or must the OUT EP also be an Bulk EP (for example Nr. 4).
0 Kudos

394 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Patrick_W on Wed Dec 30 07:02:17 MST 2015
Ah is an error from my side. This should be 512 Bytes (size of a sector and a cluster).
The whole device has an capacity of 8kB.

Sorry my fault. I will edit this.
0 Kudos

394 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Dec 30 04:40:57 MST 2015
An lpc1769 has 64k of internal ram. That is going to be reduced by the data, heap and stack used by your application. So how can you have files of size 512k?
0 Kudos

394 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Patrick_W on Wed Dec 30 02:20:06 MST 2015
I don't know why i cannot format the code, but the snippet shows the Endpoint_Read_Stream_LE function

uint16_t i;
if (endpointselected==ENDPOINT_CONTROLEP){
if(usb_data_buffer_size == 0) return ENDPOINT_RWSTREAM_IncompleteTransfer;
}else
if(usb_data_buffer_OUT_size == 0) return ENDPOINT_RWSTREAM_IncompleteTransfer;

for(i=0;i<Length;i++)
{
#if defined(__LPC17XX__) || defined(__LPC177X_8X__)
if (endpointselected!=ENDPOINT_CONTROLEP)
while(usb_data_buffer_OUT_size == 0); // Current Fix for LPC17xx, havent checked for others
#endif
((uint8_t*)Buffer) = Endpoint_Read_8();
}
return ENDPOINT_RWSTREAM_NoError;
0 Kudos