Skip to main content
bnp979
Associate III
January 24, 2015
Question

HardFault while implementing USB MSC device

  • January 24, 2015
  • 2 replies
  • 989 views
Posted on January 24, 2015 at 11:33

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

    This topic has been closed for replies.

    2 replies

    stm32cube-t
    ST Employee
    November 26, 2015
    Posted on November 26, 2015 at 18:35

    Dear user,

    You need to adjust the heap of your project (0x400).

    Best regards
    Tesla DeLorean
    Guru
    November 26, 2015
    Posted on November 26, 2015 at 18:53

    I'd double check both the heap and stack sizes defined in the startup.s are adequate.

    Note the thread was started 11 months ago.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..