我開啟看門狗後,除了看門狗可以正常動作,其他任務感覺都停止了,想請問解決的方式,因為我是做整個系統,如果一個停止我要的功能就都不會工作了
IDE:ARM8.30
BLE SDK:tirtos_cc13xx_cc26xx_2_21_01_08
CC26XX_LAUNCHXL.h
/*!
* @def CC2650_WatchdogName
* @brief Enum of Watchdogs on the CC2650 dev board
*/
typedef enum CC2650_WatchdogName {
CC2650_WATCHDOG0 = 0,
CC2650_WATCHDOGCOUNT
} CC2650_WatchdogName;
/*!
* @def SENSORTAG_CC2650_WatchdogName
* @brief Enum of Watchdogs on the SENSORTAG_CC2650 dev board
*/
typedef enum SENSORTAG_CC2650_WatchdogName {
SENSORTAG_CC2650_WATCHDOG0 = 0,
SENSORTAG_CC2650_WATCHDOGCOUNT
} SENSORTAG_CC2650_WatchdogName;
CC26XX_LAUNCHXL.c
* ============================= WatchDog Begin===========================
*/
#include <ti/drivers/Watchdog.h>
#include <ti/drivers/watchdog/WatchdogCC26XX.h>
/* Watchdog objects */
WatchdogCC26XX_Object watchdogCC26XXObjects[SENSORTAG_CC2650_WATCHDOGCOUNT];
/* Watchdog configuration structure */
const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[SENSORTAG_CC2650_WATCHDOGCOUNT] = {
// SENSORTAG_CC2650_WATCHDOG0 with 1 sec period at default CPU clock freq {WDT_BASE, INT_NMI_FAULT},
};
const Watchdog_Config Watchdog_config[] = {
{&WatchdogCC26XX_fxnTable, &watchdogCC26XXObjects[Board_WATCHDOG0], &watchdogCC26XXHWAttrs[Board_WATCHDOG0]},
{NULL, NULL, NULL},
};
/*
* ============================= WatchDog End============================
WatchDog相關函數
/*********************************************************************
* INCLUDES
*/
#include "board.h"
#include "board_watchdog.h"
#include <ti/sysbios/knl/Clock.h>
/*********************************************************************
* GLOBAL VARIABLES
*/
Watchdog_Handle g_watchdogHandle;
void watchdogCallback(uintptr_t handle);
/*********************************************************************
* LOCAL FUNCTIONS
*/
/**
@brief 软件看门狗的定时回调函数
@param none
@return none
*/
void watchdogCallback(uintptr_t handle)
{
GPIO_setOutputEnableDio(27,GPIO_OUTPUT_ENABLE);
GPIO_toggleDio(27);
Watchdog_clear((Watchdog_Handle)handle); // 喂狗
}
/*********************************************************************
* PUBLIC FUNCTIONS
*/
/**
@brief 软件看门狗的初始化函数
@param none
@return none
*/
void Watchdog_Init(void)
{
Watchdog_Params params;
uint32_t tickValue;
Watchdog_init();
Watchdog_Params_init(¶ms);
params.callbackFxn = watchdogCallback;
params.debugStallMode = Watchdog_DEBUG_STALL_ON;
params.resetMode = Watchdog_RESET_ON;
g_watchdogHandle = Watchdog_open(Board_WATCHDOG0, ¶ms);
if(g_watchdogHandle == NULL)
{
/* Error opening Watchdog */
while (1) {}
}
Watchdog_setReload(g_watchdogHandle, 1500000); // 1sec (WDT runs always at 48MHz/32)
//tickValue = Watchdog_convertMsToTicks(g_watchdogHandle, 1000);
//Watchdog_setReload(g_watchdogHandle, tickValue);
}
/*************************************END OF FILE*************************************/
Simple_peripheal.c
init中的函數呼叫
Watchdog_Init();
在WatchDog觸發復位後,我的廣播還有其他行程都停止了,想請問為什麼會這樣
Viki Shi:
有个比较详细的逐步添加看门狗的文章,建议参考一下: blog.csdn.net/…/52253536
Yushiang Wang:
回复 Viki Shi:
INT_WATCHDOG改成INT_WDT_IRQ??因為我這個版本只看的到它但是改成它之後看門狗不會自己觸發按Reset觸發後不會進入CallBack 會一直重新啟動
Viki Shi:
回复 Yushiang Wang:
timer停止是在低功耗模式下吗?
Once started, the Watchdog will keep running in Active or Idle mode. When the device enters Standby mode, the Watchdog timer will stop counting down but the counter value will be preserved. When the device wakes up from Standby, the Watchdog timer will continue to count down from the previous counter value.