diff --git a/platform/redbee-econotag/contiki-conf.h b/platform/redbee-econotag/contiki-conf.h index 0839607f9..92c2ef1b3 100644 --- a/platform/redbee-econotag/contiki-conf.h +++ b/platform/redbee-econotag/contiki-conf.h @@ -87,6 +87,12 @@ #define BLOCKING_TX 1 #define NULLRDC_CONF_802154_AUTOACK_HW 1 +#define USE_WDT 0 + +#ifndef WDT_TIMEOUT +#define WDT_TIMEOUT 5000 /* watchdog timeout in ms */ +#endif + /* end of mc1322x specific config. */ /* start of conitki config. */ diff --git a/platform/redbee-econotag/contiki-mc1322x-main.c b/platform/redbee-econotag/contiki-mc1322x-main.c index ff456e82c..268d1602a 100644 --- a/platform/redbee-econotag/contiki-mc1322x-main.c +++ b/platform/redbee-econotag/contiki-mc1322x-main.c @@ -203,6 +203,13 @@ init_lowlevel(void) *CRM_RTC_TIMEOUT = cal_rtc_secs * 10; #endif +#if (USE_WDT == 1) + /* set the watchdog timer timeout to 1 sec */ + cop_timeout_ms(WDT_TIMEOUT); + /* enable the watchdog timer */ + CRM->COP_CNTLbits.COP_EN = 1; +#endif + /* XXX debug */ /* trigger periodic rtc int */ // clear_rtc_wu_evt(); @@ -479,6 +486,10 @@ main(void) while(1) { check_maca(); +#if (USE_WDT == 1) + cop_service(); +#endif + /* TODO: replace this with a uart rx interrupt */ if(uart1_input_handler != NULL) { if(uart1_can_get()) {