how to trace the reason of hardfault

Hi all,

I am getting hardfault exception in my code. And when i watched my registers CFSR and HFSR their values are like CFSR = 0x00001100 - IBUSERR = 1 - STKERR = 1 HFSR - FORCED = 1 So can you just tell me what those flag means? And can i get that instruction just before occuring hard fault? I just want to trace the condition or instruction or function that occurs just before Hard fault. Can you tell me that?

Thanks & Regards, Jonam

What processor is this? A little more detail please.

How to use this forum

I am really sorry sir. I forgot to give you the details. Sir, i am using STM32F407 microcontroller. And for coding and compiling i am using IAR Embedded Workbench with versino 6.40. What problem i am actually facing is that due to some reasong my controller is going into the hardfault which is an exception. So i just want to trace the previous state or previous function which cause to this hardfault, and what those flag means which i have mention before in my previous message.

Hello Jonam, I am interested in the internal fault issue on microprocessors. Arduino uses several microprocessors, but I do not see your chip in the Arduino website. Your processor from STM (SGS-THOMSON Microelectronics in June 1987, from merger of SGS Microelettronica (Italy) and Thomson Semiconducteurs), may be evaluated using a "logic analyzer" . Also there is usually an internal scan chain that a test access protocol is able to observe.

Which Arduino product are you using?

It's NOT an Arduino!


You're not likely to get much help here Jonam, that's not an Arduino processor.


Oh ok. Thank you for all of you for replying me. And yes it is not arduino product. Thank you guys.

We'd still help if we could, but the chances of someone here having experience with that chip are slim I think.