Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Re: Problem with watchdog

2005-12-09 by Ake Hedman, eurosource

Ken,

yes this is probably it (as zdravko_k_d@... also pointed out 
earlier).  Strange not to have an atomic feed. First time I have come 
across that. I have the code taken apart now to try to track this down. 
But all the symptoms of the problems I have match what should be 
expected from the watchdog triggering from something else then not just 
lack of feed.

What happens if the watchdog is feed with the wrong sequence? Is it 
triggered or does it just ignore it?

Appreciate your input Ken.

/Ake

Ken Wada wrote:

> Basically, your method works fine...
> UNTIL: you start adding interrupt service routines!
>
> This is why:
> void WDOG_pet()
> {
> WDFEED = 0xAA;
> /*             Interrupt occurs here...> dog will NOT pet properly!!!
> ***/
> WDFEED = 0x55;
> }
>
> /**** example uses Keil compiler directives ***/
> /********** The following is what I wound up doing, (gotta avoid that
> spurious interrupt issue with the ARM also!!! ***/
>
> /**** The actual interface that everybody uses ***/
> void WDOG_pet (void)
> {
>     SYSSWI_service (12,0,0,0);
> }
>
> /***** How the SYSSWI_service works, (based on SWI) ***/
> unsigned SYSSWI_service (SYSSWI opcode, int id, void *pObj, unsigned
> _user1) __swi(12)
> {
>     switch (opcode)
>     {
>       case SYSSWI_WDOGPET:
>         SYSSWI_watchDogPet ();
>         break;
>       ...
>     }
>     return (0);
> }
>
> /***** How the SYSSWI_watchDogPet () works ***/
> static void SYSSWI_watchDogPet (void)
> {
>     ARM_disableFIQ ();                /* make sure FIQ is disabled    
>      */
>     WDFEED  = 0xAA;
>     WDFEED  = 0x55;
>     ARM_enableFIQ ();                 /* re-enable the FIQ            
>      */
> }
>
> /***** The IRQ is automatically disabled by vectoring to the SWI...
> however, you need to make the operation atomic with respect to FIQ,
> which is NOT disabled ***/
>
> PUBLIC  ARM_disableFIQ?A ; interface is ARM mode
>
> ARM_disableFIQ?A  PROC  CODE32
>       MRS   R0,CPSR
>       ORR   R0,R0,#0x0040                   ; Mask just the FIQ
>       MSR   CPSR_c,R0
>       BX    R14
>
>       ENDP
>
> PUBLIC  ARM_enableFIQ?A ; interface is ARM mode
>
> ARM_enableFIQ?A  PROC  CODE32
>       MRS   R0,CPSR
>       BIC   R0,R0,#0x0040                   ; Enable just the FIQ
>       MSR   CPSR_c,R0
>       BX    R14
>
>       ENDP
> END
>
>
> --- In lpc2000@yahoogroups.com, "Ake Hedman, eurosource" <akhe@b...>
> wrote:
> >
> > Hi all.
> >
> > I am trying to enable the watchdog but the result is a total hang of
> the
> > board. Not even the bootloader is possible to reach after the crash
> and
> > I have to reapply power with P0.14 low to get access to the
> botloader
> > again. Reset is not enough.
> >
> > The code to initialize the watchdog is
> >
> >     // initialize the watchdog timer
> >     WDTC = 0xffffffff; // 15000000;                        // One
> second
> > = 15000000
> >     WDMOD = WDEN | WDRESET;                    // Activate watchdog
> >     WDFEED = 0xAA; WDFEED = 0x55;
> >
> > I must have misunderstood the WD functionality. What am I doing
> wrong?
> > In the above code the watchdog should not trigger until 5 minutes
> > elapsed so even if a vector should be wrong the code that follow
> should
> > run for a while but as soon as I write to the WDMOD register I get a
> hang.
> >
> > /Ake
> >
> > --
> >  ---
> > Ake Hedman (YAP - Yet Another Programmer)
> > eurosource, Brattbergavägen 17, 820 50 LOS, Sweden
> > Phone: (46) 657 413430 Cellular: (46) 73 84 84 102
> > Company home: http://www.eurosource.se     
> > Kryddor/Te/Kaffe: http://www.brattberg.com
> > Personal homepage: http://www.eurosource.se/akhe
> > Automated home: http://www.vscp.org
> >
>
>
>
>
>
>
> SPONSORED LINKS
> Microprocessor 
> <http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=tsVC-J9hJ5qyXg0WPR0l6g> 
> 	Microcontrollers 
> <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=DvJVNqC_pqRTm8Xq01nxwg> 
> 	Pic microcontrollers 
> <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=TpkoX4KofDJ7c6LyBvUqVQ> 
>
> 8051 microprocessor 
> <http://groups.yahoo.com/gads?t=ms&k=8051+microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=1Ipf1Fjfbd_HVIlekkDP-A> 
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
>     *  Visit your group "lpc2000
>       <http://groups.yahoo.com/group/lpc2000>" on the web.
>        
>     *  To unsubscribe from this group, send an email to:
>        lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>


-- 
 ---
Ake Hedman (YAP - Yet Another Programmer)
eurosource, Brattbergavägen 17, 820 50 LOS, Sweden
Phone: (46) 657 413430 Cellular: (46) 73 84 84 102
Company home: http://www.eurosource.se      
Kryddor/Te/Kaffe: http://www.brattberg.com
Personal homepage: http://www.eurosource.se/akhe
Automated home: http://www.vscp.org



[Non-text portions of this message have been removed]

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.