Content originally posted in LPCWare by Scribe on Tue Nov 20 13:48:42 MST 2012
Hi guys,
I've been tinkering with nxpUSBlib for 3 days now and have successfully ported, for the most part, my custom media over to mass storage and am pretty happy with my experience with the library so far. I have, it seems, one final error to contend with.
When I attempt to format my mass storage from Windows, one sector of data (the first transmission) is successfully written to my flash drive, however I subsequently receive a hard fault, which I'm tracking down to the following code, which is contained within Endpoint_LPC.h.
0000217e: ldr r0, [pc, #96] ; (0x21e0 <Endpoint_Read_Stream_LE+220>)
00002180: ldrb r1, [r0, r1]
Which at the C level I believe is the following line:
tem = usb_data_buffer_OUT[usb_data_buffer_OUT_index];
If I step through my program for after flash write but before the hard fault, I seem to be able to avoid the error (though my format has timed out of course), suggesting perhaps this is a buffer overflow issue?
Any other ideas what may be causing this issue? (something I'm not doing right etc!). Also I'm considering if my flash storage is too slow... I don't think so but notice there's USB command to request a delay? Should I consider using this?
I'm running on an LPC11U14 via LPC Expresso, using nxpUSBlib v0.97.
Many thanks