Skip to main content
licencje1
Associate III
June 3, 2015
Question

STM32f407 HardFault

  • June 3, 2015
  • 3 replies
  • 1130 views
Posted on June 04, 2015 at 00:35

Can somebody explain me how to find cause of hardfault? I try to use solution from 

http://blog.frankvh.com/2011/12/07/cortex-m3-m4-hard-fault-handler/

but buffer is empty.

Here are core registers dump (from keil UI):

SP = 0x20001178

LR = 0xFFFFFFF1

PC = 0x08006604

xPSR = 0x61000003

MSP = 0x20001178

PSP = 0x00000000

Is it possible to find instruction that cause hard fault?

#stm32 #hardfault #m4
    This topic has been closed for replies.

    3 replies

    Tesla DeLorean
    Guru
    June 3, 2015
    Posted on June 04, 2015 at 00:54

    If I were doing it manually, I'd look at the code pointed at by the PC (Program Counter)

    I'd dump the 32-bit words are the top of the stack (SP), and look for addresses in the 0x08000000 FLASH memory.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    licencje1
    licencje1Author
    Associate III
    June 3, 2015
    Posted on June 04, 2015 at 01:07

    I don't understand what you meat writing ''

    I'd dump the 32-bit words are the top of the stack (SP), and look for addresses in the 0x08000000 FLASH memory.'' Could you explain it clearly for me?

    waclawek.jan
    Super User
    June 4, 2015
    Posted on June 04, 2015 at 13:47

    SP is the stack pointer and the stack grows downwards, so dump the memory above SP (look at it in the debugger) and investigate. The old program counter is stored at [SP + 0x18].