Other Parts Discussed in Thread: CC2650
Tool/software: TI-RTOS
Hi all:
Now I want to add watchdog to my project. When I delete the feed dog function,the program keep restart all the time, this looks like that my setting is success.
But when I add the feed dog function,program can only run the feed dog function even if I press the key over and over.
My own board uses CC26404*4 chip, and soft version is ble_sdk_2_02_01_18 and tirtos_simplelink_2_13_00_06.
My project is based on key_fob.
Here is my operation steps.
1、add Watchdog.c、Watchdog.h、WatchdogCC26XX.c、WatchdogCC26XX.h in ble_sdk_2_02_01_18\src\components\services\src\watchdog .
2、add option include route:$SRC_BLE_CORE$/components/services/src/watchdog
3、add code
/////////////////////////////////CC2650DK_4SX.c begin///////////////////////////////
#include "Watchdog.h"
#include "WatchdogCC26XX.h"
WatchdogCC26XX_Object watchdogCC26XXObjects[CC2650_WATCHDOGCOUNT];
const WatchdogCC26XX_HWAttrs watchdogCC26XXHwAttrs[] = {
{
.baseAddr = WDT_BASE,
.intNum = INT_NMI_FAULT,
//.intNum = INT_WDT_IRQ,
}
};
const Watchdog_Config Watchdog_config[] = {
{ &WatchdogCC26XX_fxnTable, &watchdogCC26XXObjects[0], &watchdogCC26XXHwAttrs[0] },
{ NULL, NULL, NULL },
};
/////////////////////////////////CC2650DK_4SX.c end///////////////////////////////
/////////////////////////////////CC2650DK_4SX.h begin///////////////////////////////
typedef enum CC2650_WatchdogName {
CC2650_WATCHDOG0 = 0,
CC2650_WATCHDOGCOUNT,
} CC2650_WatchdogName;
/////////////////////////////////CC2650DK_4SX.h end///////////////////////////////
/////////////////////////////////keyfobdemo.c begin///////////////////////////////
#include "Watchdog.h"
#include "WatchdogCC26XX.h"
#include <ti/drivers/power/PowerCC26XX.h>
...
void wdtCallback(UArg handle)
{
printS("wdtclear\r\n");
Watchdog_clear((Watchdog_Handle)handle);
//HAL_SYSTEM_RESET();
}
static Watchdog_Handle watchdog=NULL;
void wdtInitFxn()
{
//Board_initWatchdog();
Watchdog_Params wp;
Watchdog_Params_init(&wp);
wp.callbackFxn = wdtCallback;
wp.debugStallMode = Watchdog_DEBUG_STALL_ON;
wp.resetMode = Watchdog_RESET_ON;
watchdog = Watchdog_open(CC2650_WATCHDOG0, &wp);
Watchdog_setReload(watchdog, 3000000); // 1sec (WDT runs always at 48MHz/32)
}
static void KeyFobDemo_init(void)
{
...
wdtInitFxn();
...
}
/////////////////////////////////keyfobdemo.c end///////////////////////////////
Is there anything wrong?
Thanks very much!