EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC2103 watchdog issues

Started by Langosta39 May 19, 2006
I'm having trouble hitting the watchdog on the 2103. It works just
fine without IRQs, but after I enable interrupts I can no longer feed
it. I am disabling interrupts around the feed so it is atomic, and I
know the feed works becasue I call the same code in the init
function. I've tried using the standard __enable_interrupt
__disable_interrupt functions in IAR and I've tried directly
manipulating the CPSR as per the errata sheet with no luck. Any
advice?

Andy

An Engineer's Guide to the LPC2100 Series

One trap I fell into was that I was running my code in _user_ mode
rather than _system_ mode on the arm processor.

In user mode, you can't manipulate the interrupt enable / disable bits.

The rowley-supplied interrupt enable / disable routines assume you're
in system mode and don't work in user mode. It might be the same for
IAR (I don't know).

My way out? I now have a SWI routine to feed the watchdog
(IRQ automatically disabled - all you must do is disable FIQ
during the feed).

Hope this helps,
Danish
--- In l..., "Langosta39" wrote:
>
> I'm having trouble hitting the watchdog on the 2103. It works just
> fine without IRQs, but after I enable interrupts I can no longer feed
> it. I am disabling interrupts around the feed so it is atomic, and I
> know the feed works becasue I call the same code in the init
> function. I've tried using the standard __enable_interrupt
> __disable_interrupt functions in IAR and I've tried directly
> manipulating the CPSR as per the errata sheet with no luck. Any
> advice?
>
> Andy
>

Danish Ali wrote:

>One trap I fell into was that I was running my code in _user_ mode
>rather than _system_ mode on the arm processor.
>
>In user mode, you can't manipulate the interrupt enable / disable bits.
>
>The rowley-supplied interrupt enable / disable routines assume you're
>in system mode and don't work in user mode. It might be the same for
>IAR (I don't know).
>
>My way out? I now have a SWI routine to feed the watchdog
>(IRQ automatically disabled - all you must do is disable FIQ
>during the feed).
>
>
>

That is a good suggestion, thank you.

TomW

--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------

--- In l..., Tom Walsh wrote:

> >My way out? I now have a SWI routine to feed the watchdog
> >(IRQ automatically disabled - all you must do is disable FIQ
> >during the feed).
> >
> >
> > That is a good suggestion, thank you.

A while back we discussed the SWI method and its benefits in another
thread. If I recall correctly, I posted the SWI equivalent for the
code snippet posted by Danish Ali.

Have a look at atomicFeed() example here:

http://groups.yahoo.com/group/lpc2000/message/15358

Jaya


The 2024 Embedded Online Conference