Update to "LPC214x: USB hangs after some hours":
I went back to the original KEIL USBMEM example
(http://www.keil.com/download/files/lpc2148_usbmem.zip) and stressed
it with some simple stream-io code to exclude my driver/application
(not very nice, but does the job, call this code with the USBMEM
device letter as parameter):
int main(int argc, char* argv[])
{
int iResult = 0;
char cFile[] = "C:\\Testfile.txt";
unsigned char data[1024];
if (1 == argc)
{
char dev;
printf("Device-Letter: ");
scanf("%c", &dev);
// patch device letter
cFile[0] = dev;
}
else if (2 == argc)
{
// patch device letter
cFile[0] = argv[1][0];
}
else
{
printf("USAGE: TestUSBMasStorage [C|D|E|...]\n");
iResult = 1;
}
if (0 == iResult)
{
FILE* f;
int i;
// fill buffer
for (i = 0 ; i < sizeof(data) ; i++)
data[i] = (unsigned char)(i & 0xFF);
for (i = 0 ; 0 == iResult ; i++)
{
printf("%d\r", i);
if (NULL != (f = fopen(cFile, "wb")))
{
fwrite(data, sizeof(data), 1, f);
fflush(f);
fclose(f);
_flushall();
// read/compare data
if (NULL != (f = fopen(cFile, "rb")))
{
unsigned char cmp[sizeof(data)];
if (1 != fread(cmp, sizeof(cmp), 1, f))
iResult = 2;
else if (0 != memcmp(data, cmp, sizeof(data)))
{
iResult = 6;
}
fclose(f);
_flushall();
}
else
iResult = 4;
}
else
iResult = 3;
}
}
if (0 == iResult)
printf("\nSuccess!");
else
printf("\nError: %d\n", iResult);
return iResult;
}
With this stress the USBMEM device will hang within seconds.
The error looks the same I have in my own firmware, I reported the
problem (http://groups.yahoo.com/group/lpc2000/message/12316).
Has anybody solved this problem ?
GregorMessage
LPC214x USBMEM stressed hangs after some seconds (USB hangs after some hours)
2006-01-16 by gcopoix
Attachments
- No local attachments were found for this message.