AnsweredAssumed Answered

HardFault while implementing USB MSC device

Question asked by p.ben on Jan 24, 2015
Latest reply on Nov 26, 2015 by Clive One
Hi,
I used the CubeMX framework to implement a USB mass storage device for my STM32L1 device.
I see that the code is issuing a hard fault when the laptop connected to the device is reading sectors from the device during the enumeration process.
The "Fault Reports" window in my uVision debugger indicates a INVPC userfault, which I am guessing is the cause for the hard fault.
I tried to figure out the instruction causing the fault by following instructions in the related app note at http://www.keil.com/appnotes/files/apnt209.pdf

When I break execution in the HardFault exception handler, I see that value of LR is 0xffffffff, which means I need to retrieve the context for the exception causing code from the PSP. However, the value of PSP is 0. 

Can somebody explain why this may the case?
How can I then retrieve the address of the instruction causing the fault?

Also, are there any known issues with the Cube USB MSC code?

Thanks,
Ben

Outcomes