LPC 1114 hard fault

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

LPC 1114 hard fault

397 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by exgreyfox on Mon Jul 01 14:45:59 MST 2013
Hello gents,

I am having an issue with a hard fault in my code. Basically I have some code written up that will talk to a DAC via SPI and spit out a voltage profile (0-2.5v) and what I am trying to do is read that voltage back into the ADC input channel 0 and have it be displayed by the debugger using printf. To do this i just re-used the code from the adc example. I'm getting a hard fault as soon as I start the debugger. I'm attaching my project below. Any help is greatly appreciated.
0 Kudos
6 Replies

388 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by exgreyfox on Tue Jul 02 14:49:10 MST 2013
CodeRed, can you please elaborate on what I an doing wrong with the library usage? I am still fresh to this IDE.


Quote: CodeRedSupport
I don't have hardware here to test, but from looking at and building your project, I suspect that your problem is being caused by the following definition in the file "3a_VTG/driver/debug_printf.c"

volatile int fseek, fclose;


Comment this line out and I think this will remove the problem. Basically the above definitions are getting used, rather than the actual functions from the C library.

By the way, you really ought to clean your project up (or even start again). In particular you are linking with two libraries- CMSISv2p00_LPC11xx and lib_small_printf_m0, but then appear to have code/headers in your main project that will get used instead. Take a look at the map file created by the linker, and check what is getting pulled from where - and make sure it is what you actually expect!

Regards,
CodeRedSupport

0 Kudos

388 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by exgreyfox on Tue Jul 02 13:07:46 MST 2013
YES! That did the trick! Thank you sir


Quote: CodeRedSupport
I don't have hardware here to test, but from looking at and building your project, I suspect that your problem is being caused by the following definition in the file "3a_VTG/driver/debug_printf.c"

volatile int fseek, fclose;


Comment this line out and I think this will remove the problem. Basically the above definitions are getting used, rather than the actual functions from the C library.

By the way, you really ought to clean your project up (or even start again). In particular you are linking with two libraries- CMSISv2p00_LPC11xx and lib_small_printf_m0, but then appear to have code/headers in your main project that will get used instead. Take a look at the map file created by the linker, and check what is getting pulled from where - and make sure it is what you actually expect!

Regards,
CodeRedSupport

0 Kudos

388 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Tue Jul 02 12:33:36 MST 2013
I don't have hardware here to test, but from looking at and building your project, I suspect that your problem is being caused by the following definition in the file "3a_VTG/driver/debug_printf.c"

volatile int fseek, fclose;


Comment this line out and I think this will remove the problem. Basically the above definitions are getting used, rather than the actual functions from the C library.

By the way, you really ought to clean your project up (or even start again). In particular you are linking with two libraries- CMSISv2p00_LPC11xx and lib_small_printf_m0, but then appear to have code/headers in your main project that will get used instead. Take a look at the map file created by the linker, and check what is getting pulled from where - and make sure it is what you actually expect!

Regards,
CodeRedSupport
0 Kudos

388 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by exgreyfox on Tue Jul 02 10:45:29 MST 2013
I get a hard fault in both builds.


Quote: whitecoe
Quick forum search shows up this..

http://knowledgebase.nxp.com/showthread.php?t=4496

Maybe related to your issue?

HTH!

0 Kudos

388 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by whitecoe on Tue Jul 02 09:51:43 MST 2013
Quick forum search shows up this..

http://knowledgebase.nxp.com/showthread.php?t=4496

Maybe related to your issue?

HTH!
0 Kudos

388 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by exgreyfox on Tue Jul 02 09:19:15 MST 2013
Just did a simple printf statement in my code and got a hard fault. I see that it has to do with using the debug_printf. I still have no solution though.
0 Kudos