Other Parts Discussed in Thread: CC2640,
Tool/software: TI-RTOS
Hi!
I want to implemet Watchdog inside SimplePeripheral OAD on-chip for
CC2640. I initalize Watchdog in SimplePeripheral_taskFxn, before
endless cycle, like this (wdParams and wdHandle are global variables
in simple_peripheral_oad_onchip.c):
//init Watchdog
Watchdog_init();
Watchdog_Params_init(&wdParams);
wdParams.resetMode = Watchdog_RESET_ON;
wdParams.debugStallMode = Watchdog_DEBUG_STALL_ON;
wdParams.callbackFxn = (Watchdog_Callback) wdCallback;
wdHandle = Watchdog_open(Board_WATCHDOG0, &wdParams);
Here is my callback function:
void wdCallback(uintptr_t watchdogHandle)
{
toggleLed(); //100ms duration
Watchdog_clear(wdHandle);
}
Here are objects in my board file:
#include <ti/drivers/Watchdog.h>
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
WatchdogCC26XX_Object watchdogCC26XXObjects[GBA_BOARD_WATCHDOGCOUNT];
const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs
[GBA_BOARD_WATCHDOGCOUNT] = {
{
.baseAddr = WDT_BASE,
.reloadValue = 1000, /* Reload value in milliseconds */
},
};
const Watchdog_Config Watchdog_config[GBA_BOARD_WATCHDOGCOUNT] = {
{
.fxnTablePtr = &WatchdogCC26XX_fxnTable,
.object = &watchdogCC26XXObjects[GBA_BOARD_WATCHDOG0],
.hwAttrs = &watchdogCC26XXHWAttrs[GBA_BOARD_WATCHDOG0]
},
};
const uint_least8_t Watchdog_count = GBA_BOARD_WATCHDOGCOUNT;
When I run this code my LED doesn't toggle. If I put break point
inside wdCallback when toggleLed() not commented, then debugger show
this error after clicking resume button :
"Can't Run Target CPU: (Error -2134 @ 0x0) Unable to control device
execution state."
If toggleLed() is commented, then by clicking resume button in the
debugger every time I fall into break point into wdCallback and see
no errors.
If I remove callback function from wdParams, reset does not occur (debug probe was removed from my custom board).
My goal is to make reset after timeout if Watchdog_RESET_ON enabled.
What am I doing wrong? My SDK version is 3.10.0.15.