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/CC2640: Watchdog callback never called, causing hwi exception Reserved vector: 8

Part Number: CC2640
Other Parts Discussed in Thread: CC2650

Tool/software: TI-RTOS

Hi All,

I try to introduce watchdog for CC2640 unexpected hang up,

void watchdogCallback(uintptr_t unused)
{
  // iBSAdv.frame.data.gpi |= GPI_SOURCE_HALL;


  iBSAdv.frame.data.tag_type ++;
  // IgsBeacon_syncAdvFrame();
  // IgsBeacon_enqueueMsg(SEB_ADV_MODE_CHANGE_EVT, ADV_MODE_SINGLE_BURST);

  Watchdog_clear(watchdogHandle);
  // while(1);


  // SystemReset();
}

static void IgsWatchdog_Init(void)
{
  static Watchdog_Params params;

  Watchdog_init();

  Watchdog_Params_init(&params);
  params.resetMode = Watchdog_RESET_OFF;
  params.debugStallMode = Watchdog_DEBUG_STALL_ON;
  params.callbackFxn = (Watchdog_Callback)watchdogCallback;

  watchdogHandle = Watchdog_open(Board_WATCHDOG0, &params);

  if (watchdogHandle == NULL) {
    /* Error opening Watchdog */
    while (1);
  }
  uint32_t tick = Watchdog_convertMsToTicks(watchdogHandle, 10000);
  Watchdog_setReload(watchdogHandle, tick);
}

However watchdogCallback never be called.

Try to debug and find hwi exception happened.

Any hint or idea ?

Thanks

  • BTW I use SDK ble_sdk_2_02_02_25.
  • Hello,

    Which ble example are you using as baseline? Did you review the section 6.1 Adding a Driver in the Bluetooth® low energy Software Stack 2.2.x Developer's Guide?

    I'll put together an example as soon as I know which example did you start from.

    Thanks,

    David
  • Hi Sir,

    We based on simple peripheral example. I also tried add watchdog driver in project but no luck.
  • Some findings:

    1. Watchdog Driver NMI interrupt not working

    --- a/sdk/tirtos_cc13xx_cc26xx_2_21_01_08/products/tidrivers_cc13xx_cc26xx_2_21_01_01/packages/ti/drivers/watchdog/WatchdogCC26XX.c
    +++ b/sdk/tirtos_cc13xx_cc26xx_2_21_01_08/products/tidrivers_cc13xx_cc26xx_2_21_01_01/packages/ti/drivers/watchdog/WatchdogCC26XX.c
    @@ -245,7 +245,8 @@ static void WatchdogCC26XX_initHw(Watchdog_Handle handle) {
         }
     
         /* enable the Watchdog interrupt as a non-maskable interrupt */
    -    WatchdogIntTypeSet(WATCHDOG_INT_TYPE_NMI);
    +    // WatchdogIntTypeSet(WATCHDOG_INT_TYPE_NMI);
    +    WatchdogIntTypeSet(WATCHDOG_INT_TYPE_INT);
    

    The original WATCHDOG_INT_TYPE_INT will cause system hang while watchdog time out without calling watchdog callback

    Some thread mentioned this but it's still not fixed in sdk 2.2.2, can Ti guys confirm this ?

    2. watchdog reload time is very tricky. since watchdog only count down out of standby mode, the time is not work as expected.

    for my beacon project (most of time it should keep in standby mode), i leave watchdog without feeding and set reload time to 30 secs, it turns out that it takes 12 hours to timeout and reboot system !!

    The reload time is very hard to predict in real case.

  • Hello,

    Sam Lin46 said:
    Some thread mentioned this but it's still not fixed in sdk 2.2.2, can Ti guys confirm this ?

    Correct, this is still not fixed on the sdk 2.2.2. FYI, it is possible to update the interrupt number in your board file (CC2650_LAUNCHXL.c), for example:

    const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2650_LAUNCHXL_WATCHDOGCOUNT] = {
        {
            .baseAddr = WDT_BASE,
            .intNum = INT_NMI_FAULT/*INT_WDT_IRQ*/,
            .reloadValue = 1000 /* Reload value in milliseconds */
        },
    };

    Sam Lin46 said:
    for my beacon project (most of time it should keep in standby mode), i leave watchdog without feeding and set reload time to 30 secs, it turns out that it takes 12 hours to timeout and reboot system !!

    This will depend on the time your device is awake. If for some reason the PC is getting lost, usually it will execute code and it will not be sleeping, so in this case the watchdog timeout should be met and it will force a reset. Usually the watchdog windows are around 10 to 50ms.

    Anyway, you can try another power policy, keeping in mind that the device will consume more power. An example is using PowerCC26XX_doWFI instead of PowerCC26XX_standbyPolicy:

    /* Place into subsections to allow the TI linker to remove items properly */
    #if defined(__TI_COMPILER_VERSION__)
    #pragma DATA_SECTION(PowerCC26XX_config, ".const:PowerCC26XX_config")
    #endif
    const PowerCC26XX_Config PowerCC26XX_config = {
        .policyInitFxn      = NULL,
        .policyFxn          = &PowerCC26XX_doWFI/*PowerCC26XX_standbyPolicy*/,
        .calibrateFxn       = &PowerCC26XX_calibrate,
        .enablePolicy       = TRUE,
        .calibrateRCOSC_LF  = TRUE,
        .calibrateRCOSC_HF  = TRUE,
    };

    Hopefully this helps.

      David