LPC11C14 + LPCOpen_v2_00a = HardFault_Handler()-SOLVED

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

LPC11C14 + LPCOpen_v2_00a = HardFault_Handler()-SOLVED

4,546 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by motz on Sun Oct 05 22:04:35 MST 2014
Hello,

I am new in lpc and have a big problem.
I am using LPCXpresso_7.4.0 together with the newest lpcopen_v2_00a_lpcexpresso_nxp_lpcexpresso_11c24. I try to debug on a LPC11C14.
I am able to successfully build any example project but no matter on which project I try to debug, I always end up in the HardFault_Handler().
I do not even reach the main loop.
Of course I changed the project properties (MCU settings) to target LPC11C14/301.
My first question would be: Is the lpcopen_v2_00a_lpcexpresso_nxp_lpcexpresso_11c24 really compatible with the LPC11C14?
Right now I try to debug the uart example. Here the vectpc:

------------------------------------------------------------------------------------------------------------------
Fault PC = 0x000002C8
              = Board_Init + 8 in section .text
              = File: ../src/board.c  Line: 137

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

Stacked registers:
R0          = 0000085f
R1          = 00000002
R2          = 40048000
R3          = 00000080
R12        = a712564b
LR          = 00000377
PC         = 000002c8
PSR       = 01000200
SP         = 10001fb8
------------------------------------------------------------------------------------------------------------------

I have really no idea what I do wrong. Could somebody help me?  :~

Labels (1)
0 Kudos
Reply
12 Replies

4,480 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by motz on Tue Oct 07 01:22:42 MST 2014
Good morning!

Thanks a lot for all the answers. I was finally able to debug every project :) It was really the clock.
My next challenge is SPI :)
0 Kudos
Reply

4,480 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Mon Oct 06 09:35:10 MST 2014

Quote: wellsk
Hmm, we should really alter that chip layer function to use the board layer's const osc rate to generate the correct multiplier at run-time :(



Last not least: set FREQRANGE in SYSOSCCTRL (there's no library function in LPCOpen) ...
0 Kudos
Reply

4,480 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Mon Oct 06 09:24:25 MST 2014

Quote:
Either you use a 12MHz crystal (as LPCXpresso board) or you change your board library...

ATM you are trying to run your board with 100MHz...



Sorry, didn't see this until after the post. You pretty much nailed it!
0 Kudos
Reply

4,480 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Mon Oct 06 09:23:00 MST 2014
Default board layer code for the 11c24 uses a 12Mhz crystal setting. You will have to edit your board layer OscRateIn constant to update the crystal rate with the correct setting.
This rate is used at run-time as a time basis for a number of clock related functions.

In file board.c in the board library project...
/* System oscillator rate and clock rate on the CLKIN pin */
const uint32_t OscRateIn = 12000000; // <<< Replace me with 25000000
const uint32_t ExtRateIn = 0;


You will also have to update the chip layer code to reduce the PLL multiplier.

In file sysinit_11xx.c in the chip library project...
/* Setup PLL for main oscillator rate (FCLKIN = 12MHz) * 4 = 48MHz
   MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
   FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
   FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
Chip_Clock_SetupSystemPLL(3, 1); // Change me to (1, 1) for 2x25MHz = 50Mhz


Hmm, we should really alter that chip layer function to use the board layer's const osc rate to generate the correct multiplier at run-time
Maybe something like:

Quote:
Chip_Clock_SetupSystemPLL((50000000 / OscRateIn), 1);


0 Kudos
Reply

4,475 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by motz on Mon Oct 06 05:05:11 MST 2014
So I have to change SystemSetupClocking() only?
How do I config the clock paramters to use my 25MHz external oscillator?
Why do I try to run it with 100MHz?
0 Kudos
Reply

4,475 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Mon Oct 06 02:08:47 MST 2014

Quote: motz
I also use an external 25MHz



So it's a hardware problem  :exmark:

Either you use a 12MHz crystal (as LPCXpresso board) or you change your board library...

ATM you are trying to run your board with 100MHz...
0 Kudos
Reply

4,475 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by motz on Mon Oct 06 01:59:07 MST 2014
Hello again!

Thank you for your answer. I was able to start from ResetISR(). I can step to SystemInit()->Board_SystemInit()->SystemSetupMuxing() and everything is ok.
But when I want to enter  __main() I end up in the HardFault_Handler().
I read about the muxing table. I did not change anything on the blinky project neither on the board_lib. Could this be the reason? I also use an external 25MHz
oscillator on XTALIN.
0 Kudos
Reply

4,475 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Mon Oct 06 01:03:37 MST 2014
I suggest that you try debugging from reset and the single step through to see what is actually triggering the hard fault.

http://www.lpcware.com/content/faq/lpcxpresso/debug-from-reset

Alternatively, from your hard fault report it looks like something in the Board_Init() function is triggering the hard fault, so set a breakpoint there, and then single step through.

You might also want to consult this information on porting LPCOpen board libraries…

http://www.lpcware.com/content/faq/how-do-i-port-lpcopen-new-baord

Regards,
LPCXpresso Support
0 Kudos
Reply

4,475 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by motz on Mon Oct 06 00:51:21 MST 2014
I meant to say that the connection is fine.
You are right. It is SWD of course. I am usinge the LPC-Link (HID).
0 Kudos
Reply

4,475 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Mon Oct 06 00:34:12 MST 2014

Quote: motz
I tested the hardware and the debug connection and everything is fine. Still have the same problem :(



:quest:

So what's fine then ?


Quote: motz
Perhaps it is also important to mention that I use the JTAG interface of the LPCxpresso 11C24 eval board to debug my 11C14. Do I have to change settings to use it?



That's  SWD  :O

I'm quite sure that you've a problem with your 'fine' board or LPC-Link connection... 
0 Kudos
Reply

4,475 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by motz on Mon Oct 06 00:30:56 MST 2014
Hello LabRat!

Thank you very much for your reply.
I tested the hardware and the debug connection and everything is fine. Still have the same problem :(
I tried to debug blinky but still jump right into the HardFault_Handler().
Perhaps it is also important to mention that I use the JTAG interface of the LPCxpresso 11C24 eval board to
debug my 11C14. Do I have to change settings to use it?

0 Kudos
Reply

4,475 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Sun Oct 05 22:56:09 MST 2014

Quote: motz
My first question would be: Is the lpcopen_v2_00a_lpcexpresso_nxp_lpcexpresso_11c24 really compatible with the LPC11C14?



I don't have problems with my LPC11C14 here...

So first thing to check is your LPC11C14 board hardware and  debug connection  :)

Would suggest to start with nxp_lpcxpresso_11c24_periph_blinky and of course control your board library...

See also: http://www.lpcware.com/content/faq/lpcxpresso/debugging-hard-fault

0 Kudos
Reply