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: watchdog timeout unexpected whenever zigbee does steering(join the network)

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

Hi, Ryan & YK,

I have been enable watchdog in Zstack 3.0.2 through defined macro WDT_IN_PM1,and then feed watchdog in osal_start_system() function as following code segment,but whenever does steering call bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING),the watchdog timeout unexpected,as we all known,the maximum is 1 seconds,what's wrong with me?

void osal_start_system( void )
{
#ifdef USE_ICALL
  /* Kick off timer service in order to allocate resources upfront.
   * The first timeout is required to schedule next OSAL timer event
   * as well. */
  ICall_Errno errno = ICall_setTimer(1, osal_msec_timer_cback,
                                     (void *) osal_msec_timer_seq,
                                     &osal_timerid_msec_timer);
  if (errno != ICALL_ERRNO_SUCCESS)
  {
    ICall_abort();
  }
#endif /* USE_ICALL */

#if !defined ( ZBIT ) && !defined ( UBIT )
  for(;;)  // Forever Loop
#endif
  {
    osal_run_system();

#ifdef WDT_IN_PM1    
    WD_KICK();          //feed watchdog
#endif

#ifdef USE_ICALL
    ICall_wait(ICALL_TIMEOUT_FOREVER);
#endif /* USE_ICALL */
  }
}

  • What do you mean "the watchdog timeout unexpected"?

  • Hi behold,

    What role is your device, ZED/ZC/ZR?  Where are you kicking the watchdog inside the Zigbee application?  I do not recommend relying on osal_run_system to loop once a second, you should at least initialize a timer to ensure the watchdog is addressed reliably.

    Regards,
    Ryan

  • I agree with Ryan that it’s OK to kick watchdog after osal_run_system in ZC and ZR, but not OK for sleepy end device which might not wakeup within every second. For sleepy end device, you should start a periodic event for less than 1 second to kick watchdog.

  • our role is ZR, so don't sleepy forever,watchdog timeout caused osal reset unexpected whenever doing steering,may be should not enable watchdog whenever device does steering ?

  • I don’t think bdb commissioning would make osal_sysytem_run not working. Can you use original Z-Stack example and only add watchdog to test if you see the same issue?

  • I also don't expect a long steering time as ZR devices do not have to initialize link key tables or perform other ZC & TC network forming tasks.  Have you made any changes to the default stack settings?

    Regards,
    Ryan

  • Hi Ryan,

    sometimes,because of the environment,the ZR join the network difficultly,so we have to retry steering again in zclSampleLight_ProcessCommissioningStatus callback.

    zclSampleLight_RetryTimes variable default value is 10,so we retry 10 times,if not find any suitable network to join,we give up.but whenever does steering retry, the watchdog timeout unexpected(it seems like steering caused osal blocked overtime 1 second)

    we call bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING) at  end of zclSampleLight_Init to initialize steering power up.

    the code segments as following:

    static void zclSampleLight_ProcessCommissioningStatus(bdbCommissioningModeMsg_t *bdbCommissioningModeMsg)
    {
        switch(bdbCommissioningModeMsg->bdbCommissioningMode)
        {
            case BDB_COMMISSIONING_FORMATION:
                if(bdbCommissioningModeMsg->bdbCommissioningStatus == BDB_COMMISSIONING_SUCCESS)
                {
                    //After formation, perform nwk steering again plus the remaining commissioning modes that has not been process yet
                    bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING | bdbCommissioningModeMsg->bdbRemainingCommissioningModes);
                }
                else
                {
                    //Want to try other channels?
                    //try with bdb_setChannelAttribute
                }
                break;
            case BDB_COMMISSIONING_NWK_STEERING:
                if(bdbCommissioningModeMsg->bdbCommissioningStatus == BDB_COMMISSIONING_SUCCESS)
                {
                    // we are steering success,turn off indicate LED
                    HalLedSet(HAL_LED_8, HAL_LED_MODE_OFF);
                }
                else if(bdbCommissioningModeMsg->bdbCommissioningStatus == BDB_COMMISSIONING_IN_PROGRESS)
                {
                    // DO nothing at present
                }
                else
                {
                    if(zclSampleLight_RetryTimes > 0)
                    {
                    	// we will retry steering again
                        zclSampleLight_RetryTimes--;
                        bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING | bdbCommissioningModeMsg->bdbRemainingCommissioningModes);
                    }
                    else
                    {
                    	// we have to give up,turn off indicate LED
                        HalLedSet(HAL_LED_8, HAL_LED_MODE_OFF);
                    }
                }
                break;
            case BDB_COMMISSIONING_FINDING_BINDING:
                if(bdbCommissioningModeMsg->bdbCommissioningStatus == BDB_COMMISSIONING_SUCCESS)
                {
                    //YOUR JOB:
                }
                else
                {
                    //YOUR JOB:
                    //retry?, wait for user interaction?
                }
                break;
            case BDB_COMMISSIONING_INITIALIZATION:
                //Initialization notification can only be successful. Failure on initialization
                //only happens for ZED and is notified as BDB_COMMISSIONING_PARENT_LOST notification
    
                //YOUR JOB:
                //We are on a network, what now?
    
                break;
    #if ZG_BUILD_ENDDEVICE_TYPE
            case BDB_COMMISSIONING_PARENT_LOST:
                if(bdbCommissioningModeMsg->bdbCommissioningStatus == BDB_COMMISSIONING_NETWORK_RESTORED)
                {
                    //We did recover from losing parent
                }
                else
                {
                    //Parent not found, attempt to rejoin again after a fixed delay
                    osal_start_timerEx(zclSampleLight_TaskID, SAMPLEAPP_END_DEVICE_REJOIN_EVT, SAMPLEAPP_END_DEVICE_REJOIN_DELAY);
                }
                break;
    #endif
        }
    
    
    }

  • I see no issue with kicking the watchdog during commissioning if it helps work around the timeout.

    Regards,
    Ryan

  • It seems like set -DDEFAULT_CHANLIST=0x07FFF800 in f8wConfig.cfg may be caused wdt timeout whenever steering.

  • It sounds like when you have lots of channels enable, it will cause wdt timeout in your test. However, I see no reason why it acts so. Do you try to add kicking the watchdog during commissioning?