More HardFault!

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

More HardFault!

733 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by micrio on Mon Apr 12 06:37:52 MST 2010
I have been having a HardFault occur every time I debug my app. My app works perfectly if I power cycle my target but then I can't controll it with LPCXpresso. So it seems that the code is good.

Per recomendations here I tried the most basic of apps with the default environment. So I created a new workspace and project. I ran "Create NXP LPC1100 Project". When I debug it I still drop into the HardFault handler. The only change that I made to the default source was to select the internal RC osc as the clock source. This is what I changed;

[LEFT][COLOR=#3f7f5f][COLOR=#3f7f5f]//#define SYSPLLCLKSEL_Val 0x00000001 // Uses external [U]osc[/U].[/COLOR][/COLOR][/LEFT]
[B][COLOR=#7f0055][COLOR=#7f0055]#define [/COLOR][/COLOR][/B]SYSPLLCLKSEL_Val 0x00000000 [COLOR=#3f7f5f][COLOR=#3f7f5f]// Use internal RC [U]osc[/U].[/COLOR][/COLOR]

[LEFT]LPC_SYSCON->[COLOR=#0000c0][COLOR=#0000c0]SYSPLLCLKSEL[/COLOR][/COLOR] = SYSPLLCLKSEL_Val;[/LEFT]

[LEFT]I have included a screen shot. This shows the registers and the contents of the stack.
Is there any guide on how to read the stack frame?[/LEFT]

[LEFT]Is there any assembly opcode that I can add that causes the code to break into the debugger? I could use this to enter the debugger earlier than is possible now. I never get to the breakpoint at "main".[/LEFT]
0 Kudos
Reply
1 Reply

565 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Apr 12 07:39:02 MST 2010
This may sound like a stupid question... But have you got an LPC1100 target board or an LPC1300 target board. You would get the hard fault if (for example) you were running a project build for LPC1300 on an LPC1100 board (or vice versa).

If you are sure you have this correct, can you try importing one of the example applications, such  as Blinky, and running that. Then try modifying it. If you are still having problems, please post your project.

Re setting the breakpoint earlier, see this knowledgebase article:
http://lpcxpresso.code-red-tech.com/LPCXpresso/node/48

Also, I see from your snapshot, that the PC causing the error (VECTPC in the register view) is 0x1000000c, which is in your RAM (i.e. data area of your code). Perhaps you should look at your code to see how it ends up there...
0 Kudos
Reply