HardFault

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HardFault

3,082 Views
novakma7
Contributor I

Hi all,

I have the following problem:

My Main starts like this

    SystemCoreClockUpdate();
    Board_Init();

When I start the program directly with F8 "Run" (or turn on power) it jumps directly to "cr_startup_lpc5411x.cpp" to here

__attribute__ ((section(".after_vectors")))
void HardFault_Handler(void)
{ while(1) {}
}

When I do F6 "Step over" over the first 2 lines in main and THEN do  "Run", it runs fine

I have found out

Name : ipsr
    Hex:3  (HardFault)
    Decimal:3  (HardFault)
    Octal:3  (HardFault)
    Binary:3  (HardFault)
    Default:3  (HardFault)

Faults     = InvState
Fault PC   = 0x00000000
           = g_pfnVectors in section .text
           = No line number information available.

Fault status registers:
IPSR       = 0x1000003: 3  (HardFault)
CFSR       = 00020000 (Configurable Fault Status Register)
HFSR       = 40000000 (Hard Fault Status Register)
DFSR       = 00000000 (Debug Fault Status Register)
MMAR       = e000edf8 [INVALID] (MemManage Fault Address Register)
BFAR       = e000edf8 [INVALID] (Bus Fault Address Register)
AFSR       = 00000000 (Auxiliary Fault Status Register)

But I don´t have any clue what that means.

I run on my own board. On the devkit the program runs fine.

Labels (1)
0 Kudos
1 Reply

1,966 Views
brendonslade
NXP TechSupport
NXP TechSupport

Hard faults can be tricky ... a couple of links that might help you:

http://www.keil.com/appnotes/files/apnt209.pdf

https://mcuoneclipse.com/2012/11/24/debugging-hard-faults-on-arm-cortex-m/ (which also mentions the link above).

Looking at the step over behavior, might it be possible that some other hardware in your system is triggering an interrupt by generating a signal that happens as a result of BoardInit(), but goes away before you hit "Run" when you are stepping over? In other words, when you do a run immediately, the signal gets generated and handles an unhandled exception, but if you do the step over this signal appears then goes away before you hit step over again or run?

0 Kudos