I still think the best way is to create a reset routine that will reset the
processor using the watchdog timer, as someoe else mentioned. I've
encountered this issue many times over years, and using the watchdog was
always the best way.
I'm rather sure that once the processor is reset, you have to re-enable it
for your application (as you do normally on powerup). It shouldn't stay
enabled across reset.
--
Jim Parziale
nuncio.bitis@...
Malden, MA
On 1/30/06, Guillermo Prandi <yahoo.messenger@...> wrote:
>
> Thanks, Brendan. Yes, I thought of a hardware reset, but modifying
> the board is no longer an option at this stage. However, I would like
> to -by software- do my best effort to handle this, although I know I
> can't really cover all bases.
>
> About the watchdog, I am concerned about such a short timer. Since
> there is no way I can turn the watchdog off by software, couldn't my
> reset procedure be continually called by the watchdog, with not
> enough time to reset it properly? The LPC2138 user manual doesn't say
> if the watchdog is stopped after triggered (or at least I couldn't
> find a word about it). In fact, once the watchdog is set up, what
> attributes am I allowed to change from it afterwards?
>
> Another way that just occurred to me is the following:
>
> 1) Disable all interrupts
> 2) Relocate the interrupt vectors into RAM (I was using ROM vectors)
> 3) Place a dummy SWI at the SWI vector
> 4) Produce a SWI
> 5) Inside the SWI handler (now in supervisor mode!),
> relocate the interrupt vectors into ROM again and perform "b 0".
>
> Too messy for my liking, but it is the only sure way to enter
> supervisor mode from user mode without wasting an exception mode.
> (Currently SWI is being used by the FreeRTOS port to perform a Yield).
>
> Guille
>
> --- In lpc2000@yahoogroups.com, "brendanmurphy37"
> <brendan.murphy@i...> wrote:
> >
> >
> > 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
> > >
> >
>
>
[Non-text portions of this message have been removed]