您好!
在使用 TM4C1294KCPDT 控制器的库房板中,我需要为应用启用看门狗计时器。 我遵循 TI 示例看门狗计时器代码,中断每秒生成一次。 问题是当我将变量 g_bFeedWatchdog 用作"Zero" 控制器时,不会 复位,而是显示 “Device is locked up in Hardware fault"(设备锁定在硬件故障中)。 下面我附上了故障屏幕截图以及您的参考代码。 请告诉我编码是否有错误?
此致、
Rani
volatile bool g_bFeedWatchdog = true; void WatchdogIntHandler(void) { // // If we have been told to stop feeding the watchdog, return immediately // without clearing the interrupt. This will cause the system to reset // next time the watchdog interrupt fires. // if(!g_bFeedWatchdog) { return; } // // Clear the watchdog interrupt. // MAP_WatchdogIntClear(WATCHDOG0_BASE); // // Invert the GPIO PN0 value. // } void watch_dog() { // // Enable the peripherals used by this example. // MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION); // // Enable processor interrupts. // MAP_IntMasterEnable(); // // Set GPIO PN0 as an output. This drives an LED on the board that will // toggle when a watchdog interrupt is processed. // MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0); MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0); // // Enable the watchdog interrupt. // MAP_IntEnable(INT_WATCHDOG); // // Set the period of the watchdog timer to 1 second. // MAP_WatchdogReloadSet(WATCHDOG0_BASE, (g_ui32SysClock)); // // Enable reset generation from the watchdog timer. // MAP_WatchdogResetEnable(WATCHDOG0_BASE); // // Enable the watchdog timer. // MAP_WatchdogEnable(WATCHDOG0_BASE); }