Application does not start without programmer (only with programmer)

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

Application does not start without programmer (only with programmer)

939 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by langbein42 on Sun Aug 02 12:23:18 MST 2015
Hello,

I think I need a little bit help for my first project with the LPC1517.
I'm new with LPCXpresso and the LPC1517.
I use the LPC1517 for a hardware design and I wrote a simple application only to switch a LED depending on a pressed button. It's just for testing if programming is in general working. If I flash the software into the LPC1517 the application is running fine. So I think writing the application to flash is ok.

But if I switch of power and repower the design again, the application seems not so start.

What I did in my design:
- I pulled up the ISP0 and ISP1 pins -> the bootloader should not start
- I pulled up the RESET-Pins -> Reset should be high after power on

What can the reason be why the application does not start after power on?
Is this more likely a hardware or software problem?
Maybe I forgot some compiler settings?

I also attached the schematic of LPC1517 in my design.

Thank you
Klaus


Labels (1)
0 Kudos
9 Replies

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by langbein42 on Tue Aug 04 09:39:40 MST 2015
Hi R2D2, you are great

the missing

Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO0);


was the problem

Thanks a lot!!

0 Kudos

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Aug 03 15:11:57 MST 2015
Your schematic isn't looking wrong  and you are not using a Semihosting Library...

I'm not sure why you are not using a board library to help you init the system...

Did you enable GPIO clock somewhere?

Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO0);


Changing your code to:

 volatile uint32_t i;
 Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO0);
 LPC_GPIO->DIR[0] |= (1<<3);
 while(1)
 {
  i++;
  if(i>1E5)
  {
   i=0;
   LPC_GPIO->NOT[0] = (1<<3);
  }
 }


is working here without problems...
0 Kudos

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by langbein42 on Mon Aug 03 13:14:20 MST 2015
@lpcxpresso-support:

Thank you. Maybe I'll go one step back and make first a c-project.
But later I want to use c++ because I've got some libraries which I want to use in future.
And I'll check my project on semihosting.

Regards
Klaus
0 Kudos

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by langbein42 on Mon Aug 03 13:09:08 MST 2015
Now I've got the schematic as pdf and my project in the attached zip-file.
And thank you for the hints. I'll check my project on your hints, too.
0 Kudos

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Mon Aug 03 03:49:16 MST 2015
As R2D2 has already noted - semihosted operations are the typical cause of applications that work under the debug failing when run from reset.

https://www.lpcware.com/content/faq/lpcxpresso/semihosting

One other thing for you to be careful with is that you say you have created a C++ project. In which case, watch out for C vs C++ linkage issues (i.e. make sure you have "extern "C" { .... }" where applicable. See you favourite C++ book for more details, or else lots of stuff around the web, for example:

https://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B#Linking_C_and_C.2B.2B_code

Regards,
LPCXpresso Support
0 Kudos

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by langbein42 on Mon Aug 03 02:37:47 MST 2015
Oh, sorry. The image looked much better in original :-( I'll make a pdf.
With this code I only wanted to show that I made nothing "magic". This is the only extention to the code of what the wizard made.
And of course I can post the complete project. Unfortunately I've got no access to my PC at the moment. So I'll post it in the evening when I'mm back.
And thank you for your help :-)

(I have some experience with the LPC1768 (only one project). And there I never had this problem. But for this small application the LPC1768 is much too big.)
0 Kudos

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Aug 02 13:44:25 MST 2015
I'm not sure what you did in detail and I can't read your schematic picture  :((

Your code snippet is not very informative, could be useful to post the complete project  ;-)
0 Kudos

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by langbein42 on Sun Aug 02 13:37:57 MST 2015
I don't think so.
I created a "LPC-OPEN" project (C++) with the Wizard.
Then I inserted the code for switching the LED. Nothing more.
Maybe I used it "hidden" but it was not my intention to use it.

My main() is very simple:

int main(void) {

#if defined (__USE_LPCOPEN)
    // Read clock settings and update SystemCoreClock variable
    SystemCoreClockUpdate();
#if !defined(NO_BOARD_LIB)
    // Set up and initialize all required blocks and
    // functions related to the board hardware
    Board_Init();
    // Set the LED to the state of "On"
    Board_LED_Set(0, true);
#endif
#endif


LPC_GPIO->DIR[0] = 0x00000008;

while(1)
{
  if (Chip_GPIO_GetPinState(LPC_GPIO, 0, 2))
  {
  //Chip_GPIO_WritePortBit(LPC_GPIO, 0, 3, 1);
  //Chip_GPIO_SetPortOutHigh(LPC_GPIO, 0, 0x0008);
  LPC_GPIO->SET[0] = 0x00000008;
  }
  else
  {
  //Chip_GPIO_WritePortBit(LPC_GPIO, 0, 3, 0);
  //Chip_GPIO_SetPortOutLow(LPC_GPIO, 0, 0x0008);
  LPC_GPIO->CLR[0] = 0x00000008;
  }
}
return 0 ;
}
0 Kudos

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Aug 02 12:43:26 MST 2015
Are you using a Semihosting Library?
0 Kudos