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.

CC2530: [CC2530] Implementing a watch dog timer in ZStack-3

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Hi,

Currently on CC2530 Watch Dog (When enabled) is kicking in for every 1 second. <Max interval> 

As my application needs the WatchDog to be longer than that, say every 30 seconds. I need some way to change this.

I have followed the example in 

e2e.ti.com/.../63728

changing in OSAL.c, but it was not clearing the WatchDog at all, and instead once the code entered into while(1) WatchDog is not killing that hang task.

Did any one succeed in CC2530 or similar Zigbee devices with latest Z stack to have a WatchDog longer than 1 second?

Regards,

Anvesh

  • If I remember correctly, max duration of CC2530 watchdog is 1 second and you cannot extend it. The application has to kick watchdog within 1 second.
  • Hi Anvesh,

    The watchdog time timer interval is well defined in the CC2530 User's Guide (SWRU191) for a maximum time-out period of 1 second.

    Regards,
    Ryan
  • Thanks YiKai and Ryan for the answers,
    I did read the user Guide before posting my question, However I wanted to know if I there is any other way to enhance this 1 second WD Timer.
    1. Could you please let me know where should I call this WatchDog enable in zstack 3.
    2. Can I have a dummy task that wakes up every 0.5 seconds and Clear this Watch Dog so that the WatchDog timer will only trigger if this dummy task was denied execution?
    3. if solution 2 is indeed possible, should this dummy task have priority least or better than most other tasks?
    Regards,
  • 1. There’s no way to extend 1 second watchdog duration.
    2. You can start a periodic event that is invoked every 500 ms to kick watchdog.
    3. There’s no priority in CC2530 Z-Stack task queue. It’s FIFO task queue.
  • Thanks YiKai for the reply.

    However I could not understand 3. There’s no priority in CC2530 Z-Stack task queue. It’s FIFO task queue

    a. Does it mean if a Task 1., goes into Infinite loop holding CPU., There is no way it can relinquish the CPU for other tasks to kill this?
    b. So WatchDog could only be implemented in the Context of Interrupts as no Task will get CPU once a Task hung?

    Regards,
  • A. Yes. Basically, you have to avoid infinite loop.
    B. No, you can put it in the loop of osal_run_loop.
  • YiKai,

    Thanks for your suggestion (B).

    I have implemented Watchdog_Enable in OSAL run loop and it's working fine.

    Only thing is how do I implement Watchdog_Clear in Zstack. I did not find any examples any where. (There will be few operations that could be lengthier than 1 sec when I need to Clear the Watch Dog)

    Will statement "WDCTL = WDCLR;" do the job for this? or I need to clear all the bits that were set during Watchdog_Enable?

    Regards,

  • Anvesh,

    In watchdog mode the timer is cleared (loaded with zero) when 0xA followed by 0x5 is written to the CLR bits (7:4 of WDTCL). Note that the timer is only cleared when 0x5 is written within one watchdog clock period after 0xA was written. So two sequential instructions are required.

    Regards,
    Ryan
  • Do I misunderstand something from you? I suppose you should call Watchdog_Enable, which is to enable watchdog, in osal_init_system and call Watchdog_Clear, which is to kick watchdog periodically, in osal_run_loop.
  • Thanks YiKai and Ryan.

    WD implementation in OSAL.c worked fine.