Hi All,
  I need a watchdog in my app and I'm using IRIS platform (use atmega1281 as
MPU) . So i want to test the watchdog first. But something strange is: when
run with atmega1281, after the watchdog time-out, software can't start-up
again, which seems like the MPU haven't start. but when the same app run
with atmega128, all things are as expected -- the software run, then
watchdog time-out and reset the MPU, software start again, and loop.
  So i come here and ask for help -- what the problem may be?  Many Thanks.

  Here is my simple test app:

  module wdtC
{
  uses interface Boot;
  uses interface Leds;
  uses interface Timer<TMilli> as Timer;
}

implementation
{
  uint8_t firstTime;

  uint8_t mcusr_mirror;

  void get_mcusr(void) \
  __attribute__((naked)) \
  __attribute__((section(".init3")));

  void get_mcusr(void)
  {
   mcusr_mirror = MCUSR;
   MCUSR = 0;
   wdt_disable();
  }

  event void Boot.booted()
  {

    firstTime = 1;
    call Leds.led0On();
    call Leds.led1On();
    call Timer.startPeriodic(3000);
  }

  event void Timer.fired()
  {
    call Leds.led1Off();

    if (firstTime)
   {
       firstTime = 0;
       wdt_enable(WDTO_1S); // the watchdog will time-out after 1s
   }

 else
 {
     wdt_reset();
 }

 call Leds.led2On();
}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to