When I add a callback to the watchdog in my CC2650 empty project (running tirtos 2.20) the chip hangs.
These are the changes made to an empty project for the CC2650DK_7ID:
// Added headers
#include <inc/hw_ints.h>
#include <inc/hw_memmap.h>
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
#include <ti/drivers/power/PowerCC26XX.h>
// Added to empty.c
Watchdog_Handle watchdogHandle;
extern uint32_t WatchdogCC26XX_convertMsToTicks(uint32_t milliseconds);
#define WATCHDOG_COUNT 1
#define WATCHDOG_TIMEOUT_MS 6000
WatchdogCC26XX_Object watchdog_objects[WATCHDOG_COUNT];
const WatchdogCC26XX_HWAttrs watchdog_hwAttributes[WATCHDOG_COUNT] = {
{
.baseAddr = WDT_BASE,
.intNum = INT_WDT_IRQ,
.reloadValue = 10000
}
};
const Watchdog_Config Watchdog_config[WATCHDOG_COUNT] = {
{
.fxnTablePtr = &WatchdogCC26XX_fxnTable,
.object = &watchdog_objects,
.hwAttrs = &watchdog_hwAttributes
}
};
void watchdog_callback(UArg a0) {
PIN_setOutputValue(ledPinHandle, Board_LED1, 0);
while(1); // stall here to check if callback is being called
}
void watchdog_init()
{
Watchdog_init();
Watchdog_Params params;
Watchdog_Params_init(¶ms);
params.callbackFxn = watchdog_callback;
params.resetMode = Watchdog_RESET_OFF;
params.debugStallMode = Watchdog_DEBUG_STALL_ON;
watchdogHandle = Watchdog_open(0, ¶ms);
Watchdog_setReload(watchdogHandle, WatchdogCC26XX_convertMsToTicks(WATCHDOG_TIMEOUT_MS));
/* Avoid standby to keep the watchdog running */
Power_setConstraint(PowerCC26XX_SB_DISALLOW);
}
int main(void)
{
Task_Params taskParams;
/* Call board init functions */
Board_initGeneral();
// Board_initI2C();
// Board_initSPI();
// Board_initUART();
// Board_initWatchdog();
watchdog_init();
...
}
I was able to confirm that the watchdog was working by switching the reset mode to on and observing resets.
If i halt it after a while I can see that its in this state:
Any assistance in debugging this issue is greatly appreciated!