EmbeddedRelated.com
Forums

LPC17xx Flash download fail

Started by Nico Christie October 7, 2010
Hi guys, I'm having a little big problem with my uC. I'm writing code for an
LPC1751 that enters Power Down mode almost right after startup. It sets up
the system and peripherals and then enters Power Down. The problem is
neither a GPIO nor RTC interrupt ever wake it up. Both were working fine but
it seems I missed something and now I can't re-flash the uC. I'm guessing
because the ULink2 tries to write when the uC is already sleeping. I have
SWDIO, SWCLK and /RESET pins conected to the ULink debugger. I tried setting
the debugger options in uVision4 to write with all combinations of pre-reset
available, but had no luck! Apparently it waits to long after lifting the
reset signal... =(

Is there anything to do?? Please let me know!

--
Nicol Christie
n...@gmail.com

An Engineer's Guide to the LPC2100 Series

--- In l..., Nico Christie wrote:
>
> Hi guys, I'm having a little big problem with my uC. I'm writing code for an
> LPC1751 that enters Power Down mode almost right after startup. It sets up
> the system and peripherals and then enters Power Down. The problem is
> neither a GPIO nor RTC interrupt ever wake it up. Both were working fine but
> it seems I missed something and now I can't re-flash the uC. I'm guessing
> because the ULink2 tries to write when the uC is already sleeping. I have
> SWDIO, SWCLK and /RESET pins conected to the ULink debugger. I tried setting
> the debugger options in uVision4 to write with all combinations of pre-reset
> available, but had no luck! Apparently it waits to long after lifting the
> reset signal... =(
>
> Is there anything to do?? Please let me know!
>
> --
> Nicol Christie
> nicolas.christie@...
>
How about getting it into ISP mode? P2.10 needs to be low when the chip comes out of reset. See section 31 of the User Manual.

You can use serial programming to write a new image.

Richard

Hello Richard, thank you for the tip. My board is not prepared for ISP
flashing and it would be difficult to hand-change the wire setup to allow
it. It's a growing product, and most of all, a growing experience in
developing boards =) ...

However, since we do have more than one board for developing/testing, I
tried the following with another one:

#define SLEEPDEEP 0x04
#define POWER_DOWN 0x09

void main (void) {

...

SCB->SCR |= SLEEPDEEP;
LPC_SC->PCON |= POWER_DOWN;

while (BUTTON_PUSHED) { /* do nothing to prevent sleep */ }

while (1)
{
// main loop
...
// __WFI( );
}
}

The WFI call is now commented and there is a blocking chance for code to
proceed in order to keep the processor from entering any possible power
saving mode.

Regrettably, I left the two lines setting SCR and PCON before the blocking
while and it turns out I now can't re-flash this uC either. I'm guessing
this is the source of the problem since it is the only remaining change I
made from just before starting with the power saving experimentation that
executes before the blocking while, but it makes no sense...

I will keep trying to find a way to enable ISP programming anyway.

Regards,

On Thu, Oct 7, 2010 at 8:09 PM, rtstofer wrote:

> --- In l... , Nico Christie
> wrote:
> >
> > Hi guys, I'm having a little big problem with my uC. I'm writing code for
> an
> > LPC1751 that enters Power Down mode almost right after startup. It sets
> up
> > the system and peripherals and then enters Power Down. The problem is
> > neither a GPIO nor RTC interrupt ever wake it up. Both were working fine
> but
> > it seems I missed something and now I can't re-flash the uC. I'm guessing
> > because the ULink2 tries to write when the uC is already sleeping. I have
> > SWDIO, SWCLK and /RESET pins conected to the ULink debugger. I tried
> setting
> > the debugger options in uVision4 to write with all combinations of
> pre-reset
> > available, but had no luck! Apparently it waits to long after lifting the
> > reset signal... =(
> >
> > Is there anything to do?? Please let me know!
> >
> > --
> > Nicol Christie
> > nicolas.christie@...
> > How about getting it into ISP mode? P2.10 needs to be low when the chip
> comes out of reset. See section 31 of the User Manual.
>
> You can use serial programming to write a new image.
>
> Richard
>
>
>

--
Nicol Christie
n...@gmail.com
I managed to wake sleeping beauty entering ISP mode succesfully! =)

I still don't know why it froze like that though... does anyone have a PMU
library for LPC17xx? Including the PLL manual shutdown needed according to
the errata?

Thanks for the help so far anyway, it saved me a lot of time!

On Fri, Oct 8, 2010 at 9:39 PM, Nico Christie wrote:

> Hello Richard, thank you for the tip. My board is not prepared for ISP
> flashing and it would be difficult to hand-change the wire setup to allow
> it. It's a growing product, and most of all, a growing experience in
> developing boards =) ...
>
> However, since we do have more than one board for developing/testing, I
> tried the following with another one:
>
> #define SLEEPDEEP 0x04
> #define POWER_DOWN 0x09
>
> void main (void) {
>
> ... SCB->SCR |= SLEEPDEEP;
> LPC_SC->PCON |= POWER_DOWN;
>
> while (BUTTON_PUSHED) { /* do nothing to prevent sleep */ }
>
> while (1)
> {
> // main loop
> ...
> // __WFI( );
> }
> }
>
> The WFI call is now commented and there is a blocking chance for code to
> proceed in order to keep the processor from entering any possible power
> saving mode.
>
> Regrettably, I left the two lines setting SCR and PCON before the blocking
> while and it turns out I now can't re-flash this uC either. I'm guessing
> this is the source of the problem since it is the only remaining change I
> made from just before starting with the power saving experimentation that
> executes before the blocking while, but it makes no sense...
>
> I will keep trying to find a way to enable ISP programming anyway.
>
> Regards,
>
> On Thu, Oct 7, 2010 at 8:09 PM, rtstofer wrote:
>
>> --- In l... , Nico Christie
>> wrote:
>> >
>> > Hi guys, I'm having a little big problem with my uC. I'm writing code
>> for an
>> > LPC1751 that enters Power Down mode almost right after startup. It sets
>> up
>> > the system and peripherals and then enters Power Down. The problem is
>> > neither a GPIO nor RTC interrupt ever wake it up. Both were working fine
>> but
>> > it seems I missed something and now I can't re-flash the uC. I'm
>> guessing
>> > because the ULink2 tries to write when the uC is already sleeping. I
>> have
>> > SWDIO, SWCLK and /RESET pins conected to the ULink debugger. I tried
>> setting
>> > the debugger options in uVision4 to write with all combinations of
>> pre-reset
>> > available, but had no luck! Apparently it waits to long after lifting
>> the
>> > reset signal... =(
>> >
>> > Is there anything to do?? Please let me know!
>> >
>> > --
>> > Nicol Christie
>> > nicolas.christie@...
>> >
>>
>> How about getting it into ISP mode? P2.10 needs to be low when the chip
>> comes out of reset. See section 31 of the User Manual.
>>
>> You can use serial programming to write a new image.
>>
>> Richard
>>
>>
>> --
> Nicol Christie
> n...@gmail.com
>

--
Nicol Christie
n...@gmail.com