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.

how to use watchdog ?

Other Parts Discussed in Thread: Z-STACK

Hi all

         if i enable WDT_IN_PM1 in the zstack,  how could i feed the dog ? and  how long could  i cfg the feed dog duty?

BR!

  • Hi Seven,

    Which device are you using?, are you running on a certain version of the Z-Stack?
  • Hi The Seven,

    The maximum ruining time is obtained  with WDTIMX. Do you want to have the watchdog timer only after the application is running? in that case you need to implement a timer in the application that refresh the timer:

    // In the app_event_loop

     if ( events & SAMPLEAPP_WD_REFRESH_EVT )

     {

       WatchDogEnable( WDTIMX );

       osal_start_timerEx(YourApp_TaskID, SAMPLEAPP_WD_REFRESH_EVT , 1000);

       return ( events ^ SAMPLEAPP_END_DEVICE_REJOIN_EVT );

     }

    Then just trigger the event at the end of the App_Init() with osal_set_event( YourApp_TaskID, SAMPLEAPP_WD_REFRESH_EVT  ). The WatchDogEnable() will give you a time equal to clock period × 32,768 (~1 s) when running the 32-kHz with WDTIMX so, the timer will refresh the watchdog just before it expires.

     

    I hope this helps.

     

    Regards,

  • Hi  Jose Maria Alvarez

         thanks  for your reply !

         if  my device power support by battery, should  i stop SAMPLEAPP_WD_REFRESH_EVT  when it go into sleep ?

    BR! 

  • Hi The Seven,

    The source clock for the watchdog is enabled in the sleep mode so the SAMPLEAPP_WD_REFRESH_EVT must be runing in order to feed the dog wich means that the microcontroller will be waking up on each SAMPLEAPP_WD_REFRESH_EVT  timeot. Remember to enable the ISR_KEYINTERRUPT compilation flag in order to avoid the key polling event.

    Regards,