avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] wdt problem with mega 88


From: Björn Haase
Subject: Re: [avr-libc-dev] wdt problem with mega 88
Date: Tue, 21 Jun 2005 19:25:08 +0200
User-agent: KMail/1.7.1

In order to trace byck your problem, I think that it would be useful if you 
compile your code with the -S parameter in order to generate assembly output 
and have a look at the code that is generated. Check whether there is a 
difference between what you find in your assembly file and what you expect 
from the avr datasheet.

Yours,

Björn

address@hidden wrote on Dienstag, 21. Juni 2005 18:22 :
> Hello list,
>
> I'm wondering if anyone has any ideas on the following. This program
> demonstrates the issue:
>
> #include <avr/io.h>
> #include <avr/wdt.h>
>
> #define CHIPOK PD7
>
> #define sbi(p,m) ((p) |= (1<<m))
> #define cbi(p,m) ((p) &= ~(1<<m))
>
> void delay( unsigned int delay )
> {
>       unsigned int a;
>       for( a = 0; a < delay ; a++ )
>       {
>               //wdt_reset();
>       }
> }
>
> int main( void )
> {
>       //turn off the wdt
>       wdt_disable();
>
>       //set to output
>       sbi( DDRD, CHIPOK );
>
>       //delay
>       delay( 30000 );
>
>       //turn on led
>       sbi( PORTD, CHIPOK );
>
>       //loop
>       while( 1 )
>       {
>               ;;
>       }
>
>       return 0;
> }
>
> I would expect this program to wait for a time and then turn on an led
> indefinately.
>
> What actually happens depends on whether wdt_reset is commented out.
>
> wdt_reset commented: led is off and stays off (because the WDT is
> timing out before the delay ends, and resets the program)
>
> wdt_reset uncommented: led is flashing (because the delay completes
> but then the WDT times out in the main loop)
>
> It appears that the WDT is on even though I am turning it off.
>
> RE fuse settings: the WDT fuse stuff is set in the high byte, bit 4 - which
> should be unprogrammed (1) for no WDT. My high byte fuse reads as:
>
> Fuse High Byte     = 0xdf (0b11011111)
>
> Which is correct.
>
> Does anyone have any ideas as to what the issue is here? I'm pretty
> sure its WDT issues, but when I checked the MCUSR, the only reset flag
> was the power on reset. I could never detect the WDT reset.
>
> Any replies to my address please, as I'm not subscribed.
>
> Cheers,
>
> Matthew




reply via email to

[Prev in Thread] Current Thread [Next in Thread]