This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Hard Fault exception

Hello all,

I'm using Atsam3s4a(cortex -m3) with keil Ide. I see my code gets locked in hard fault handler in Startup_sam3s.h (start up file generated by Ide). when i look into fault status registers

BFSR with PRECISERR and STKERR
MFSR with MUNSTKERR, MSTKERR and MMARVALID
UFSR with INVSTATE and NOCP bits are set. (sometimes bus fault alone occurs).

I followed the steps given in this application note
http://www.keil.com/appnotes/files/apnt209.pdf

Looking into the execution stack stored on the stack provides PC = 004029EA. As specified in the above pdf Bit 0 is not set indicating - Attempt to switch from Thumb to ARM mode.

Double clicking on the top most entry of the call stack pane highlighted the point where the exception occurred

0x004029E8 4886 LDR r0,[pc,#536]; @0x00402c04
0x004029EA 6B40 LDR ro,[r0,#0x34] in dis assembly window (original code is in C)

Can anyone tell me how to correct this error?

Thanks,
Unithra C