How to debug HardFault?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to debug HardFault?

2,251 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by karuna on Sat Jun 04 06:11:54 MST 2011
I am using lpc1769 and uip stack for Ethernet. When transferring data continuously, code stops at HardFault_Handler rarely.
  What are the possibilities for this error to occur? How to debug this?
  When inspecting core registers, got these status info
  IPSR - 3(Hard Fault)
  Faults - PreciseErr, StkErr
  
  How to eliminate this unreliable behavior? pls help..:mad:
  
  Thanks in advance..
0 项奖励
回复
6 回复数

1,960 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kabirbansod on Sun Jun 14 21:33:41 MST 2015
Thanks a lot. :)
0 项奖励
回复

1,960 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Sat Jun 13 11:57:29 MST 2015
What I didn't see in the other documents:

If you have a hard fault that occurs rarely (so you can't provoke it while debugging your code), you can look at the values of PC, LR (R14) and the values on the stack, to see if there are any addresses that point into your code. You can then use the .map file and .lst files to reconstruct where in your code the hard fault occurred.
0 项奖励
回复

1,960 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Sat Jun 13 06:41:32 MST 2015
Hi,
I think below appnote is also useful to understand faults and corresponding registers.
http://www.keil.com/appnotes/files/apnt209.pdf

Also see below page  on lpcware
http://www.lpcware.com/content/faq/lpcxpresso/debugging-hard-fault

0 项奖励
回复

1,960 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Sat Jun 13 02:30:52 MST 2015
Buy yourself a good book on Cortex-M parts... Such as the Definitive Guide books by Joseph Yiu.
0 项奖励
回复

1,959 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kabirbansod on Sat Jun 13 02:27:37 MST 2015
What does this mean? :

BusFault_Handler
Details:{void (void)} 0xcc <BusFault_Handler>
Default:{void (void)} 0xcc <BusFault_Handler>
Decimal:<error reading variable>
Hex:<error reading variable>
Binary:<error reading variable>
Octal:<error reading variable>

What can be wrong in my code that is causing PRECISE data bus error?
0 项奖励
回复

1,959 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by whitecoe on Sat Jun 04 08:53:43 MST 2011
In the first place, I would suggest looking at the FAQ "Debugging a hard fault" ! ;)
http://support.code-red-tech.com/CodeRedWiki/DebugHardFault

HTH!
0 项奖励
回复