EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Software reset

Started by Moses McKnight March 6, 2012
Hi,

Is there a way to do a software reset in the LPC17xx chips? I wrote a
USB bootloader and I would like a way to enter the bootloader from the
main firmware without the user having to manually do something on the board.

I guess one option might be to simply reset the program counter back to
0x00?

Thanks,
Moses

An Engineer's Guide to the LPC2100 Series

On 06/03/2012 14:16, Moses McKnight wrote:
> Hi,
>
> Is there a way to do a software reset in the LPC17xx chips? I wrote a
> USB bootloader and I would like a way to enter the bootloader from the
> main firmware without the user having to manually do something on the board.
Then standard technique is to use the WDT with a short delay. Here's the
code I've used with an LPC2148:

WDTC = 0x00000FFF; // very short timeout
WDMOD = 0x03; // watchdog resets CPU
WDFEED = 0xAA; // start watchdog
WDFEED = 0x55;

Something similar should work with the LPC17xx devices.

Leon
--
Leon Heller
G1HSM
On 03/06/2012 08:31 AM, Leon Heller wrote:
> On 06/03/2012 14:16, Moses McKnight wrote:
>> Hi,
>>
>> Is there a way to do a software reset in the LPC17xx chips? I wrote a
>> USB bootloader and I would like a way to enter the bootloader from the
>> main firmware without the user having to manually do something on the board.
> Then standard technique is to use the WDT with a short delay. Here's the
> code I've used with an LPC2148:
>
> WDTC = 0x00000FFF; // very short timeout
> WDMOD = 0x03; // watchdog resets CPU
> WDFEED = 0xAA; // start watchdog
> WDFEED = 0x55;
>
> Something similar should work with the LPC17xx devices.
>

That makes sense, thanks!

Moses
Hi,

Two other options:

1) invalid WDT feed sequence causes immediate reset (though you
still need to enable it first with a valid feed sequence):

After writing 0xAA to WDFEED, access to any Watchdog register other than writing
0x55 to WDFEED causes an immediate reset/interrupt when the Watchdog is enabled.
The reset will be generated during the second PCLK following an
incorrect access to a
Watchdog register during a feed sequence.

2) Cortex-M's NVIC has a reset function. You can use CMSIS's
NVIC_SystemReset() function or write to AIRCR manually.

On Tue, Mar 6, 2012 at 15:34, Moses McKnight wrote:
> On 03/06/2012 08:31 AM, Leon Heller wrote:
>> On 06/03/2012 14:16, Moses McKnight wrote:
>>> Hi,
>>>
>>> Is there a way to do a software reset in the LPC17xx chips? I wrote a
>>> USB bootloader and I would like a way to enter the bootloader from the
>>> main firmware without the user having to manually do something on the board.
>> Then standard technique is to use the WDT with a short delay. Here's the
>> code I've used with an LPC2148:
>>
>> WDTC = 0x00000FFF; // very short timeout
>> WDMOD = 0x03; // watchdog resets CPU
>> WDFEED = 0xAA; // start watchdog
>> WDFEED = 0x55;
>>
>> Something similar should work with the LPC17xx devices.
>> That makes sense, thanks!
>
> Moses

--
WBR, Igor
On 03/06/2012 08:54 AM, Igor Skochinsky wrote:
> Hi,
>
> Two other options:
>
> 1) invalid WDT feed sequence causes immediate reset (though you
> still need to enable it first with a valid feed sequence):
>
> After writing 0xAA to WDFEED, access to any Watchdog register other than writing
> 0x55 to WDFEED causes an immediate reset/interrupt when the Watchdog is enabled.
> The reset will be generated during the second PCLK following an
> incorrect access to a
> Watchdog register during a feed sequence.
>
> 2) Cortex-M's NVIC has a reset function. You can use CMSIS's
> NVIC_SystemReset() function or write to AIRCR manually.

Aha! I thought I had remembered a reset function, but when I went
looking through the manual I could not find it.

Thanks,
Moses
Hi,It works for the LPC2119 to make an incorrect feed for watchdog  after it has been enabled to reset CPU:WDFEED = 0; // wrong feed sequence makes it reset
A second suggestion is to use function pointer for jumping:(*(void(*)())ENTRY_ADDR_USB_BOOTLOADER)();
Finally, take a try on this inline assembly statement:asm ( "B ENTRY_ADDR_USB_BOOTLOADER" );
--- On Tue, 3/6/12, Leon Heller wrote:

From: Leon Heller
Subject: Re: [lpc2000] Software reset
To: l...
Date: Tuesday, March 6, 2012, 6:31 AM

 





On 06/03/2012 14:16, Moses McKnight wrote:

> Hi,

>

> Is there a way to do a software reset in the LPC17xx chips? I wrote a

> USB bootloader and I would like a way to enter the bootloader from the

> main firmware without the user having to manually do something on the board.

Then standard technique is to use the WDT with a short delay. Here's the

code I've used with an LPC2148:

WDTC = 0x00000FFF; // very short timeout

WDMOD = 0x03; // watchdog resets CPU

WDFEED = 0xAA; // start watchdog

WDFEED = 0x55;

Something similar should work with the LPC17xx devices.

Leon

--

Leon Heller

G1HSM












The 2024 Embedded Online Conference