Built in breakpoint at Hard Fault handler?

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

Built in breakpoint at Hard Fault handler?

643 Views
jdupre
Contributor II

I'm experiencing a hard fault on a LPC1517.  I've extended the handler function in cr_startup_lpc15xx.c to turn on a pin to use as an external trigger.

However, when the hard fault occurs, the debugger stops the code at the _entry_ into the handler, so my instruction does not get called.  (If I click the "resume" or "step over" buttons, the instruction does get executed.)

Is there a way to prevent this apparent automatic break point from occurring?

__attribute__ ((section(".after_vectors")))
void HardFault_Handler(void)
{

   *((volatile unsigned int *) 0x1c002200) = (1<<4);  //set p0.4

   while(1) {}
}

0 Kudos
1 Reply

381 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Probably the quickest way to remedy this is edit the DEMCR peripheral register after your application is downloaded to flash and execution has halted. Bit 10 is the vector catch for a hard fault condition (VC_HardFault). Set this bit to zero to disable the vector catch for this fault condition. Note that Bit 10 should remain clear until debugger initiated restart/reset event. If you restart your application, check the enable state of the VC_HardFault bit. You'll likely have to clear the bit again, as the debugger facility for remembering configured vector catch events is disabled.

Thanks and regards,

LPCXpresso Support

0 Kudos