在线时间46 小时
UID2094162
注册时间2017-8-7
NXP金币0
TA的每日心情 | 擦汗 2020-1-10 11:05 |
---|
签到天数: 13 天 [LV.3]偶尔看看II
中级会员
- 积分
- 382
- 最后登录
- 2020-11-12
|
问题: LPC55S6X跑FreeRTOS,开启了看门狗,只要一喂狗就复位???
void watchdog_init(void)
{
wwdt_config_t config;
uint32_t wdtFreq;
/* Enable FRO 1M clock for WWDT module. */
SYSCON->CLOCK_CTRL |= SYSCON_CLOCK_CTRL_FRO1MHZ_CLK_ENA_MASK;
/* Set clock divider for WWDT clock source. */
CLOCK_SetClkDiv(kCLOCK_DivWdtClk, 1U, true);
/* The WDT divides the input frequency into it by 4 */
wdtFreq = CLOCK_GetFreq(kCLOCK_WdtClk) / 4;
NVIC_EnableIRQ(WDT_BOD_IRQHandler);
WWDT_GetDefaultConfig(&config);
/*
* Set watchdog feed time constant to approximately 4s
* Set watchdog warning time to 512 ticks after feed time constant
* Set watchdog window time to 1s
*/
config.timeoutValue = wdtFreq * 4;
config.warningValue = 512;
config.windowValue = wdtFreq * 1;
/* Configure WWDT to reset on timeout */
config.enableWatchdogReset = true;
/* Setup watchdog clock frequency(Hz). */
config.clockFreq_Hz = CLOCK_GetFreq(kCLOCK_WdtClk);
WWDT_Init(WWDT, &config);
}
int main(void)
{
CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);
BOARD_InitPins();
BOARD_BootClockFROHF96M();
BOARD_InitDebugConsole();
PRINTF("Hello world.\r\n");
watchdog_init();
WWDT_Refresh(WWDT);
if (xTaskCreate(hello_task, "Hello_task", configMINIMAL_STACK_SIZE + 10, NULL, hello_task_PRIORITY, NULL) != pdPASS)
{
PRINTF("Task creation failed!.\r\n");
while (1)
;
}
vTaskStartScheduler();
for (;;)
;
}
static void hello_task(void *pvParameters)
{
for (;;)
{
WWDT_Refresh(WWDT);
PRINTF("Hello task.\r\n");
vTaskDelay(1000);
}
}
最佳答案
你这是开启了窗口看门狗1-4s,然后1s没到就去喂狗了?
|
|