Hello,
Tricky one to post and get a diagnosis but I thought I'd try
1) Using Rowley CrossWorks because MCUExpresso is... well I never really worked out how it worked. It's also not our in house preferred tool.
2) Using the LPC libraries (i'm not sure what version, I inherited this project and the files were a bit mangled in the end, however my present code calls are now the same as 1.0.3).
I am using the NXP USB driver as a mass storage host. Overall things are working - I can detect a USB stick, get the data from it telling me it's made by SanDisk and so forth (this is all just the initialisation from the example code - nothing I've written).
However, when I come to try read data from the disk, in the first case, Sector 0 to get the partition table, I use the MS_BulkRecv function but get a hard fault during the USB transaction. The Host_ProcessTD() function is the sticking point. This is already called three times during the initialisation process (where it reports the brand etc). The curiosity is that if I single step through the code, the read works fine and I get something resembling a FAT32 MBR!
Regarding the library code, this is refactored to a better coding standard but is unchanged. My present feeling is around memory locations. Behind the scenes the USB has two types of memory, the fast AHB memory where all the end points live; it also has standard memory. I wonder if my receive buffers all need to be in the AHB memory block and going through the debugger slowly gets rid of the race condition. Beyond that I haven't much idea.
Has anyone got any thoughts on the Gotchas involved in this part of the code and USB or any ideas of a place we can look first? As I wrote this I wasn't sure what to attach since my code is largely the USB library!
Thanks