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.

RTOS/CC2630: Add watchdog to Zigbee HA 1.2.2a sample switch

Part Number: CC2630


Tool/software: TI-RTOS

I wan to add watchdog to reset CC2630 chip when software and hardware error. I have product with hanging issue and could not be fix.

I follow this post with tirtos_cc13xx_cc26xx_2_21_00_06 driver lib. I put below code to main.c

Watchdog_Handle hWDT;

void wdtCallback(UArg a0) {
  Watchdog_clear(hWDT);
}

void wdtInitFxn() {
  Watchdog_Params wp;
  Watchdog_Params_init(&wp);
  wp.callbackFxn    = wdtCallback;
  wp.debugStallMode = Watchdog_DEBUG_STALL_ON;
  wp.resetMode      = Watchdog_RESET_ON;

  hWDT = Watchdog_open(Board_WATCHDOG0, &wp);
  if (hWDT == NULL) {
        /* Error opening Watchdog */
        while (1);
  }
  Watchdog_setReload(hWDT, Watchdog_convertMsToTicks(hWDT, 10000)); // 2*1500000 1sec (WDT runs always at 48MHz/32)
}

I call wdtInitFxn() in  Switch_initialization(void) of switch.c

The watchdog work, i put break point on  Watchdog_clear(hWDT) it will call after 10 seconds, but the program only work for 10 seconds before Watchdog_clear, seem the task of the Zigbee application not call after that.

Anyone can help me to solve the problem?

  • Try to refer to discussions in e2e.ti.com/.../740136
  • I have follow all from that link, it is what i mention in the first, but there is no WatchdogUnlock / WatchdogLock / WatchdogReloadSet for tirtos_cc13xx_cc26xx_2_21_00_06 driver lib .
    I use HAL_SYSTEM_RESET() / SysCtrlSystemReset() in WDT callback. Do you know if systems reset also reset NVram? Because 1 of my test device disconnect the network and must re-pairing
  • No, HAL_SYSTEM_RESET() / SysCtrlSystemReset() should not clear NV.
  • Thank you. After move the watchdog code to switch.c it work.
    But my problem still not solve with Watchdog. When CC2630 hang and WDT reset, it lost the NVRAM.
  • How do you judge it loses NVRAM?
  • First i connect the custom board CC2630 with the ZNP and then sometimes it hang and after power cycle not reconnect to the ZNP, allow join again it will reconnect. I could not fix it so i use watch dog to reset if it hang, it not hang anymore but lost it NVRAM after reset. So it is a failed product, I mean my custom board
  • I don't think the NVRAM is lost. I suggest you to debug and read _NIB after watchdog reset to verify this.
  • I don't know what _NIB mean?
  • NIB is a data structure to keep necessary network information as in the followings:

    typedef struct
    {
    byte SequenceNum;
    byte PassiveAckTimeout;
    byte MaxBroadcastRetries;
    byte MaxChildren;
    byte MaxDepth;
    byte MaxRouters;

    byte dummyNeighborTable; // to make everything a byte!!

    byte BroadcastDeliveryTime;
    byte ReportConstantCost;
    byte RouteDiscRetries;

    byte dummyRoutingTable; // to make everything a byte!!

    byte SecureAllFrames;
    byte SecurityLevel;
    #if defined ( COMPATIBILITY_221 ) // Obsolete - do not use
    byte nwkAllFresh;
    #endif
    byte SymLink;
    byte CapabilityFlags;

    uint16 TransactionPersistenceTime;

    byte nwkProtocolVersion;

    // non-standard attributes
    byte RouteDiscoveryTime;
    byte RouteExpiryTime; // set to 0 to turn off expiration of routes

    // non-settable
    uint16 nwkDevAddress;
    byte nwkLogicalChannel;
    uint16 nwkCoordAddress;
    byte nwkCoordExtAddress[Z_EXTADDR_LEN];
    uint16 nwkPanId;

    // Other global items - non-settable
    nwk_states_t nwkState;
    uint32 channelList;
    byte beaconOrder;
    byte superFrameOrder;
    byte scanDuration;
    byte battLifeExt;
    uint32 allocatedRouterAddresses;
    uint32 allocatedEndDeviceAddresses;
    byte nodeDepth;

    // Version 1.1 - extended PAN ID
    uint8 extendedPANID[Z_EXTADDR_LEN];

    // Network key flag
    uint8 nwkKeyLoaded;
    // Key information - Moved out of the NIB structure after ZStack 2.3.0
    // If these elements are going to be reused make sure to consider the size
    // of the structures and padding specific to the target where the stack is
    // going to be running.
    nwkKeyDesc spare1; // Not used
    nwkKeyDesc spare2; // Not used

    // Zigbee Pro extensions
    uint8 spare3; // nwkAddrAlloc deprecated - not used anymore
    uint8 spare4; // nwkUniqueAddr deprecated - not used anymore
    uint8 nwkLinkStatusPeriod; // The time in seconds betwee link status
    // command frames
    uint8 nwkRouterAgeLimit; // The number of missed link status
    // command frames before resetting the
    // link cost to zero
    uint8 nwkUseMultiCast;
    // ZigBee Pro extentions: MTO routing
    uint8 nwkIsConcentrator; // If set, then the device is concentrator
    uint8 nwkConcentratorDiscoveryTime; // Time period between two consecutive MTO route discovery
    uint8 nwkConcentratorRadius; // Broadcast radius of the MTO route discovery

    #if defined ( COMPATIBILITY_221 ) // Obsolete - do not use
    uint8 nwkMaxSourceRoute;
    uint8 nwkSrcRtgExpiryTime;
    #else
    uint8 nwkAllFresh;
    #endif

    uint16 nwkManagerAddr; // Network Manager Address
    uint16 nwkTotalTransmissions;
    uint8 nwkUpdateId;
    } nwkIB_t;