TI中文支持网
TI专业的中文技术问题搜集分享网站

TI的大神们帮我看下cc1310的看门狗程序对吗?我发了两份程序

#include <ti/drivers/watchdog/WatchdogCC26XX.h>

#include <driverlib/watchdog.h>
#include <inc/hw_ints.h>
#include <inc/hw_memmap.h>
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
#include <ti/drivers/power/PowerCC26XX.h>

Watchdog_Handle watchdogHandle;

//========看门狗程序1============================================================================

extern uint32_t WatchdogCC26XX_convertMsToTicks(uint32_t milliseconds);

#define WATCHDOG_COUNT 1
#define WATCHDOG_TIMEOUT_MS 666

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_init()
{
Watchdog_init();
Watchdog_Params params;
Watchdog_Params_init(&params);
watchdogHandle = Watchdog_open(0, &params);
Watchdog_setReload(watchdogHandle, WatchdogCC26XX_convertMsToTicks(WATCHDOG_TIMEOUT_MS));

/* Avoid standby to keep the watchdog running */
Power_setConstraint(PowerCC26XX_SB_DISALLOW);
}

void watchdog_kickWatchdog()
{
Watchdog_setReload(watchdogHandle, WatchdogCC26XX_convertMsToTicks(WATCHDOG_TIMEOUT_MS));
}

//============================================看门狗程序2======================================

//=====看门狗回调函数=======
void wdtCallback(UArg handle){ Watchdog_clear((Watchdog_Handle)handle);}//==========看门狗功能函数=====
void cc1310_watchdog_init(void){ 

Watchdog_init();
Watchdog_Params params; // 错误块
Watchdog_Handle watchdog; // 看门狗句柄 Watchdog_Params_init(&params); // 可用于处理在创建任务对象期间可能出现的错误
params.callbackFxn = wdtCallback; // 该回调函数清除看门狗定时 params.debugStallMode = Watchdog_DEBUG_STALL_ON; params.resetMode = Watchdog_RESET_ON; watchdog = Watchdog_open(0, &params); // 打开看门狗 Watchdog_setReload(watchdog, 1500000); // 1sec (WDT runs always at 48MHz/32) 看门狗重置值
// Power_setConstraint(PowerCC26XX_SB_DISALLOW);
}

fang wang6:

回复 Eggsy Pang:

看门狗超时,在哪儿重启系统了?

赞(0)
未经允许不得转载:TI中文支持网 » TI的大神们帮我看下cc1310的看门狗程序对吗?我发了两份程序
分享到: 更多 (0)