cancel
Showing results for 
Search instead for 
Did you mean: 

Hard fault STM32F3

rachid
Associate
Posted on August 05, 2013 at 14:58

Hello;

am using UART communication between 2 boards contaning STM32F3, the first send the same frame every 320 ms, and the second just receive this and make autobaud.

after 2 minutes of working my MCU go into HARD-FAULT-HANDLER !

i don't undestand why !

(HARD_FAULT_STAT = 0x40000000)

#stm32f3-hard_fault-uart
4 REPLIES 4
Posted on August 05, 2013 at 16:04

i don't undestand why !

Probably the same reason most people end up there, cause you're writing to memory you shouldn't be. Check the bounds of arrays you are writing.

Use a Hard Fault handler which allows you to identify the faulting instruction, and registers at the fault.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rachid
Associate
Posted on August 06, 2013 at 09:02

thank you for reply,

i don't know how to do this : ''Use a Hard Fault handler which allows you to identify the faulting instruction''

 

in my Hard Fault handler there is just an empty infinite loop, 

frankmeyer9
Associate II
Posted on August 06, 2013 at 11:33

Using your favourite search engine, look for joseph yiu and hard fault handler. He has written nice books, covering this topic (beside others).

BTW, I guess your problem is either stack overflow, out-of-bounds array access, or a dangling pointer.

I use debug output via UART at such occasions. This way, you can easily narrow down to the bug location.

Posted on August 06, 2013 at 16:49

As you can imagine this topic come up over-and-over

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/How%20to%20debug%20hard%20fault%20handler%20exceptions&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=1163]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FHow%20to%20debug%20hard%20fault%20handler%20exceptions&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=1163

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

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