USB mass storage class (MSC) hang-ups

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by DannyBergh on Thu Jul 31 01:45:43 MST 2014
The last weeks i am trying to make my application to work stable, but a seem to have some trouble with the USBD ROM code.

I am using a LPC4370 with the M0App core that starts the USB device like the USB MSC example code from the LPCOpen library does. The M4 core does some intense calculations and uses DMA to write directly to the memory that is allocated for the USB MSC disk. The PC (Linux) is accessing this device as block device and shares the same addresses (offsets) to read from the correct places.

Simple scenario:
1. PC sends a data "command" to block 0 of the USB MSC.
1a. PC constantly reads block 0 to check if data is ready .. (continues to step 5)
2. LPC can see this data and start the calculation using DMA.
3. The transfer is directly written to block 1 of the USB MSC.
4. LPC updates block 0 after the calculations are done to inform the PC that the data is ready.
5. PC has confirmed from block 0 that the transfer is ready and reads block 1 to get the data.
6. Repeat from step 1.

While this is running, some other blocks in the memory are used for other communication tasks that run less frequently (and run on the M0Sub core).

The problem i see is that the system is responding good for roughly a minute (sometimes 5 seconds, sometimes 2 minutes, mostly random) and then the PC is trying to read from the device, but gets no answer back. This causes the application to crash, since this read should not fail. When i hook up the debugger and watch what the M0App core is doing (that started the USB ROM stack), i see the address 0x10401e28. And i see this almost all the times i am trying this. The offset is in the USBD ROM stack, but i have no code to debug. It seems to wait for something there, but what??

Is it not allowed to access the USB memory from multiple cores at the same time?? What source can be found at the magical 0x10401e28 address?

As far as is can see in the debugger, the rom versions : Core = 1, Hardware Interface version = 1, MSC class = 1, DFU class = 1, HID class = 1, CDC class = 1.

Thank you,