Mass Storage read/write performance on LPC18xx

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ngraum on Sun Nov 04 14:08:38 MST 2012
Hello, I am using nxpUSBlib v0.97 in host mode on the LCP1830 Xplorer development board. I am wondering if there are current known outstanding issues/todo's in the library that will provide substantial speed improvements with later releases. A little backstory:

In my application I wasn't seeing very good transfer rates (~30kB/s), so I wrote a small app based off the MassStorageHost example to benchmark nxpUSBlib. The application simply does loops of MS_Host_ReadDeviceBlocks or MS_Host_WriteDeviceBlocks, similar to the SD Card example provided for the Xplorer. What I found was maximum transfer rates not a lot higher than what I had been seeing.

I began poking around the library to see where the bottleneck could be. The first thing I noticed is that the LPC1830 was not actually running at its maximum clock rate of 180MHz. I modified CGU_Init() to run the processor at this speed and verified it was indeed running at 180MHz. This did increase my benchmarks, as one would expect, to values around 130kB/s.

Next I tried reading multiple sectors at once. I found that this greatly helped performance, which was now around 250-260kB/s. However, writing multiple sectors at once doesn't seem to be implemented in the library yet (the app freezes). If you look in the source for nxpUSBlib, it becomes apparant as to why due to the differences in implementation in PipeStream_LPC.c between Pipe_Read_Stream_LE() and Pipe_Write_Stream_LE().

Digging deeper, I found what appears to be a todo item in EHCI.c: Inside HcdDataTransfer() there is a comment which reads "/* For simplicity, this only queue one TD only */" with a call to AllocQTD, where QueueQTDs is commented out. I tried uncommenting it and commenting AllocQTD, but performance suffered slightly. There are other todo's to be seen in the code, particularly in Pipe_LPC.h (about things to implement later) as well as some in EHCI.c.

I don't want this to sound like a rant (nxpUSBlib is really quite a nice library to be provided free of charge). However, I would like to know, does the nxpUSBlib team maintain a list of known issues and their potential effect on performance and/or reliability of the library? I would be very interested in getting a copy of this information or at least what is planned for releases in the near future. Thank you!