Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Software reset or alike

2006-01-30 by brendanmurphy37

Guillermo,

From past experience, the best way to "soft" reset a microcontroller 
is to use some form of hardware reset. I haven't heard of any issues 
with any of the LPC2000 series peripherals, but on some micros, it is 
possible for some of the peripherals to get latched into states that 
can't be recoevered by software (that is, you can't reliably re-
configure them). Because of this, some form of hardware reset is 
usually best to get the system into a known, initial, state.

Two suggestions:

1. If you can spare an I/O pin, use an o/p pin to feed-back into the 
reset line (i.e. self-reset). Advantage: simple. Disadvantage: need 
h/w.

2. Use the watchdog: configure it for a very short time, and then 
spin round (or goto idle state) without feeding it. Advantage: 
reasonably simple, no hardware required. Disadvantage: you may 
already be using the watchdog, and if so, may need additional code to 
distinguish a real watchdog (unexpected) reset from an intended soft 
reset.

I'm sure there's plenty of other ways too.

Brendan

--- In lpc2000@yahoogroups.com, "Guillermo Prandi" 
<yahoo.messenger@m...> wrote:
>
> Hi. What would be the software sequence the most similar to a 
> hardware reset? I am aware that certain things cannot be changed 
from 
> software, like the watchdog, once it is started, but perhaps 
there's 
> something closer to a reset than:
> 
> msr   CPSR_c,#MODE_SVC|I_BIT|F_BIT
> b 0
> 
> This would not work if in user mode, for instance, for I cannot 
> change CPSR from that mode, I guess.
> 
> I am using LPC2138/LPC2148 in my board. Perhaps the IAP/ISP code 
> could be useful somehow?
> 
> I've been thinking on reusing an existing exception to start 
> such "software reset", like Undefined or something, but I rather 
use 
> it to detect the true exception if I can manage. I would like to 
> write a solid piece of software, so I want all the bases covered, 
> whenever possible.
> 
> Any ideas?
> 
> Guille
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.