Hard Fault on line 'Endpoint_Read_Stream'

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

Hard Fault on line 'Endpoint_Read_Stream'

923 Views
lpcware
NXP Employee
NXP Employee
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
Labels (1)
0 Kudos
Reply
2 Replies

914 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxpUSBlib team on Mon Nov 26 11:00:11 MST 2012
Apologies for the late reply. The hard-fault problem with the latest release has been fixed and a new v0.98a release is now up there and available for download.
Please give this one a try. In the meantime we will do some testing to see if we can determine what's going on.

Regards
0 Kudos
Reply

914 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Scribe on Tue Nov 20 16:29:25 MST 2012
OK,

I've confirmed this is a bug in v0.97 with the LPC11U14 when attempting to write to mass storage as this error also appears in the untouched example when attempting to write to dataram.

I'm assuming this is an issue between the 64B end-point size and the VIRTUAL_MEMORY_BLOCK_SIZE of 512B. In all other NXP chips, the end-point is also 512B and so I'm assuming we have some buffer over/underflow somewhere here. From the looks of Endpoint_Read_Stream_LE etc, there should be some code to deal with this that isn't implemented.

I see that a different approach is taken in v0.98 but as reported here, another bug is preventing use with the LPC11U14: http://www.lpcware.com/content/forum/nxpusblib-hard-fault-lpcexpresso-11u14-and-baseboard-rev-b

It would be great to get some help/support from NXP as currently there appears to be no working mass storage for the LPC11Uxx series in any recent library version. Would love to get my project off the ground and start selling some chips!

Many thanks
0 Kudos
Reply