工程师您好:我现在在使用c5517看门狗功能,遇到如下问题。
(1)其看门狗的时钟是TIM2的时钟吗?
(2)喂狗的时间是如何计算的?
(3)如何喂狗?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好 我测试了 发现counter计数器设置的大小与看门狗的时间无关,只与prescale有关 而且还是prescale+1的关系。
/* Watchdog timer Object structure */
CSL_WdtObj wdtObj;
CSL_Status status;
CSL_WdtHandle hWdt = NULL;
WDTIM_Config hwConfig,getConfig;
T2INSR=0x0006; //选择时钟
/* Open the WDTIM module */
hWdt = (CSL_WdtObj *)WDTIM_open(WDT_INST_0, &wdtObj, &status);
if(NULL == hWdt)
{
UART_Str("WDTIM: Open for the watchdog Failed\n");
}
else
{
UART_Str("WDTIM: Open for the watchdog Passed\n");
}
hwConfig.counter = 12000; //开始值0xFFFF
hwConfig.prescale = 1; //预分频寄存器0x0FFF
/* Configure the watch dog timer */
status = WDTIM_config(hWdt, &hwConfig);
if(CSL_SOK != status)
{
UART_Str("WDTIM: Config for the watchdog Failed\n");
}
else
{
UART_Str("WDTIM: Config for the watchdog Passed\n");
}
/* Read the configured values */
status = WDTIM_getConfig(hWdt, &getConfig);
if(CSL_SOK != status)
{
UART_Str("WDTIM: Get Config for the watchdog Failed\n");
}
else
{
UART_Str("WDTIM: Get Config for the watchdog Passed\n");
}
/* Verify the configurations */
if((hwConfig.counter != getConfig.counter)||(hwConfig.prescale != getConfig.prescale))
{
UART_Str("WDTIM: Get and Set Configuration Mis-Matched \n");
}
else
{
UART_Str("WDTIM: Get and Set Configuration Matched \n");
}
/* Start the watch dog timer */
status = WDTIM_start(hWdt);