cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f407 HardFault

licencje1
Associate II
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
3 REPLIES 3
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
Up vote any posts that you find helpful, it shows what's working..
licencje1
Associate II
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?

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].