This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2538: CC2538 Watchdog

Part Number: CC2538

HI, I'm using stack version 2.6.3 with CC2538 module.

I need to use the Watchdog.

There is a  #define to enable it?

If I define  WDT_IN_PM1 , the compiler says:

Error[Pe223]: function "WatchDogEnable" declared implicitly ...\Projects\zstack\ZMain\TI2538DB\ZMain.c 163

Error[Pe020]: identifier "WDTIMX" is undefined ...Projects\zstack\ZMain\TI2538DB\ZMain.c 163

There is any function to use the watchdog ?

Best regards,

  • Try to include watchdog.h.
  • I did, but the error still there :(
  • You can use one of the following defines to replace WDTIMX
    #define WATCHDOG_INTERVAL_32768 0x00000000 // Timer select: Twdt x 32768
    #define WATCHDOG_INTERVAL_8192 0x00000001 // Timer select: Twdt x 8192
    #define WATCHDOG_INTERVAL_512 0x00000002 // Timer select: Twdt x 512
    #define WATCHDOG_INTERVAL_64 0x00000003 // Timer select: Twdt x 64
  • Hi Chen, I solved !

    I copied from TI2530DB\OnBoard.h to TI2538DB\OnBoard.h the following:


    #define SMWDTHROSC_WDCTL 0x400D5000 // Watchdog Timer Control
    #define WDCTL HWREG(SMWDTHROSC_WDCTL)
    #define WDINT0 0x01 // Interval, bit0
    #define WDINT1 0x02 // Interval, bit1
    #define WDINT 0x03 // Interval, mask
    #define WDMODE 0x04 // Mode: watchdog=0, timer=1
    #define WDEN 0x08 // Timer: disabled=0, enabled=1
    #define WDCLR0 0x10 // Clear timer, bit0
    #define WDCLR1 0x20 // Clear timer, bit1
    #define WDCLR2 0x40 // Clear timer, bit2
    #define WDCLR3 0x80 // Clear timer, bit3
    #define WDCLR 0xF0 // Clear timer, mask
    #define WDTISH 0x03 // Short: clk * 64
    #define WDTIMD 0x02 // Medium: clk * 512
    #define WDTILG 0x01 // Long: clk * 8192
    #define WDTIMX 0x00 // Maximum: clk * 32768
    #define WDCLP1 0xA0 // Clear pattern 1
    #define WDCLP2 0x50 // Clear pattern 2


    #define WatchDogEnable(wdti) \
    { \
    WDCTL = WDCLP1 | WDEN | (wdti & WDINT); \
    WDCTL = WDCLP2 | WDEN | (wdti & WDINT); \
    }


    Works fine !!

    Thanks for your support