嵌入式实操----基于RT1170 首板硬件之WDT调试(二十)
本文主要是通过迁移的思维,记录本人初次使用NXP MCUXpresso SDK API进行BSP开发
本文主要是描述整合看门狗(WDT)接口,供应用开发人员使用。
1. 首先阅读原理图
NA
2. 调试过程
2. 1 WDT初始化
/*----------------------------------------------*
* macros *
*----------------------------------------------*/
#define WDOG1_TIMEOUT_SEC 8
/**
* @brief wdog1 init
*
* @param [in] void
* @param [out] None
*
* @return
*
* @history
* 1.Date : 2021-6-2 13:30:47
* Author : panzidong
* Modification : Created function
*/
void bsp_wdog1_init(void)
{
wdog_config_t config;
/*
* wdogConfig->enableWdog = true;
* wdogConfig->workMode.enableWait = true;
* wdogConfig->workMode.enableStop = false;
* wdogConfig->workMode.enableDebug = false;
* wdogConfig->enableInterrupt = false;
* wdogConfig->enablePowerdown = false;
* wdogConfig->resetExtension = flase;
* wdogConfig->timeoutValue = 0xFFU;
* wdogConfig->interruptTimeValue = 0x04u;
*/
WDOG_GetDefaultConfig(&config);
//config.timeoutValue = 0xFU; /* Timeout value is (0xF + 1)/2 = 8 sec. */
config.timeoutValue = (WDOG1_TIMEOUT_SEC*2) -1 ; /* Timeout value is (0xF + 1)/2 = 8 sec. */
WDOG_Init(WDOG1, &config);
}
2. 2 WDT刷新(喂狗)
/**
* @brief feed wdog1
*
* @param [in] void
* @param [out] None
*
* @return
*
* @history
* 1.Date : 2021-6-2 13:30:32
* Author : panzidong
* Modification : Created function
*/
void bsp_feed_wdog1(void){
WDOG_Refresh(WDOG1);
}
3. 总结
NA