cc1310 看门狗没有调用回调函数 程序贴出来了
#include <inc/hw_ints.h>
#include <inc/hw_memmap.h>
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <driverlib/watchdog.h>
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include "task_watchdog.h"
Watchdog_Handle watchdogHandle;
extern uint32_t WatchdogCC26XX_convertMsToTicks(uint32_t milliseconds);
#define WATCHDOG_COUNT 1
#define WATCHDOG_TIMEOUT_MS 1500000
#define CC1310_LAUNCHXL_WATCHDOGCOUNT 1
/*
* =============================== Watchdog ===============================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(Watchdog_config, ".const:Watchdog_config")
#pragma DATA_SECTION(watchdogCC26XXHWAttrs, ".const:watchdogCC26XXHWAttrs")
#endif
#include <ti/drivers/Watchdog.h>
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
WatchdogCC26XX_Object watchdogCC26XXObjects[CC1310_LAUNCHXL_WATCHDOGCOUNT];
const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1310_LAUNCHXL_WATCHDOGCOUNT] = {
{
.baseAddr = WDT_BASE,
.intNum = INT_WDT_IRQ,
.reloadValue = 1000 /* Reload value in milliseconds */
},
};
const Watchdog_Config Watchdog_config[] = {
{
.fxnTablePtr = &WatchdogCC26XX_fxnTable,
.object = &watchdogCC26XXObjects[0],
.hwAttrs = &watchdogCC26XXHWAttrs[0]
},
{NULL, NULL, NULL},
};
void wdtCallback(UArg a0) {
uint32_t currVal = 0,dogIntStatus;
//currVal = PIN_getOutputValue(Board_LED0);// 获取引脚的状态值
dogIntStatus=WatchdogIntStatus();//获取当前看门狗定时器中断状态。1 中断产生
if(dogIntStatus){
PIN_setOutputValue(ledPinHandle, Board_LED0, 0);
}
// WatchdogIntClear();
//Watchdog_setReload(watchdogHandle, WatchdogCC26XX_convertMsToTicks(WATCHDOG_TIMEOUT_MS));
while(1); // stall here to check if callback is being called
}
void cc1310_watchdog_init()
{
Watchdog_init();
Watchdog_Params params; // 错误块
Watchdog_Handle watchdog; // 看门狗句柄
Watchdog_Params_init(¶ms); // 可用于处理在创建任务对象期间可能出现的错误
params.callbackFxn = wdtCallback; // 该回调函数清除看门狗定时
params.debugStallMode = Watchdog_DEBUG_STALL_ON;
params.resetMode = Watchdog_RESET_ON;
watchdog = Watchdog_open(0, ¶ms); // 打开看门狗
Watchdog_setReload(watchdog, 1500000); // 1sec (WDT runs always at 48MHz/32) 看门狗重置值
/* Avoid standby to keep the watchdog running */
Power_setConstraint(PowerCC26XX_SB_DISALLOW);
}
有回调函数,没有进入。您再仔细看看。
#include <inc/hw_ints.h>
#include <inc/hw_memmap.h>
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include "Board.h"
#include "menu.h"
Watchdog_Handle watchdogHandle;
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(¶ms);
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);
}
void
watchdog_kickWatchdog()
{
Watchdog_setReload(watchdogHandle, WatchdogCC26XX_convertMsToTicks(WATCHDOG_TIMEOUT_MS));
}