Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Atmega32 expert help required...

Status
Not open for further replies.

maxer

Member level 5
Joined
May 18, 2001
Messages
86
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,286
Activity points
774
atmega32 sei

Hi!

I have done a program for atmega32 in winavr.this program uses a state machine and serial port communication.its job is to receive commands from a pc and switch relays on its output,it can also give the status of its various inputs to the pc.

Now the code functions as it should but as the pc polls the atmega32 (16Mhz Xtal) many times the micro gives a correct response but at certain undefined time the micro resets itself loosing this way the values of the registers i previously wrote to them from the PC.
Now the causes of a reset can be:
1) Power on reset (i checked the +5v and it never falls down ,it is always 5v)
so i excluded it.
2) Jtag cable which is disabled by fuse setting of JTAGEN
3) Brown out detection which is disabled by Fuse BODEN.
4) WATCHDOG.

in the code there are critical pieces of code that are run by disabling the interrupts
CLI() and after execution reenabling the global interrupts SEI().
I looked at the fuses of ATMEGA32 and it does not have a fuse for WDTEN ,watchdog enabling/disabling so i think the watchdog depends only from the values in WDTCR register.
I never used this register but to be sure i wrote a procedure to disable it :

cli( );
_WDR( );
WDTCR|=(1<<WDTOE)|(1<<WDE);
WDTCR=0X00;
sei();

Even after this the code in undetermined time resets itself.

Do you have any idea why this happens???

How can i disable permanently or temporary the watchdog in Atmega32?

thank you for your help

maXer
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top