go_away

Author Topic: Axon and Watchdog timer  (Read 1479 times)

0 Members and 1 Guest are viewing this topic.

Offline adastaTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 1
Axon and Watchdog timer
« on: February 03, 2009, 04:42:50 PM »
Hello Folks,

I have been trying to use the watchdog timer on the Axon, but I have not been able to get the watchdog timer to work when I use the Fboot bootloader.  Only when I use my own hardware programmer will the watchdog timer reset the system.

With both the hardware and bootloader I program the axon with the standard initialization code that comes with the Axon and then:

wdt_enable(WDTO_2S);
while (1==1);

Then wait for the Axon to reset.  This works with my stk500 but does not work with FBOOT17.exe

Has anyone gotten the WDT timer to work while using the boot loader?  Does the boot loader disable the watchdog timer for some reason?

- Thanks for the help


Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: Axon and Watchdog timer
« Reply #1 on: February 04, 2009, 01:45:42 AM »
Quote
Does the boot loader disable the watchdog timer for some reason?

I don't know the answer to this question as I didn't write the bootloader, but I have a few thoughts that might help . . .

The bootloader is automatically activated after the Axon resets. If I remember right, the bootloader waits about 0.3 seconds before moving out of the bootloader section.

Looking at the bootloader code, it appears the earlier version doesn't account for the watch dog timer. The later 2.1 version has this assembly code in it below. Since you have a STK500, try uploading the latest bootloader I compiled and see if it works. If it doesn't I'll look into it further.

Code: [Select]
;------------------------------ check, if watchdog active ----------------
wdr
xin a0, WDTCSR
ori a0, 1<<WDCE ; change enable
ldi a1, 1<<WDE^1<<WDP2^1<<WDP1^1<<WDP0 ; 2s
xout WDTCSR, a0
sbrc a0, WDE
xout WDTCSR, a1
;-------------------------------------------------------------------------


Offline adastaTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 1
Re: Axon and Watchdog timer
« Reply #2 on: February 04, 2009, 09:34:21 AM »
Awesome,  it worked.  The new boot loader allows the WDT to execute correctly. 

Thanks for the help!

 


Get Your Ad Here