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.

[参考译文] TM4C1294KCPDT:看门狗计时器-TM4C1294KCPDT

Guru**** 656470 points
Other Parts Discussed in Thread: TM4C1294KCPDT
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1108599/tm4c1294kcpdt-watchdog-timer--tm4c1294kcpdt

器件型号:TM4C1294KCPDT

您好!

  在使用 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);
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Rani、

    这对我来说也是没有意义的、因此我怀疑这要么是误解 IDE 连接到器件的方式以及复位的影响、要么是系统发生错误、我们需要尝试和调试。

    我要问的第一组问题是:

    • 您可以将任何项目加载到器件中吗? 如果是、请查看第二组问题。
    • 如果没有、您是否尝试解锁器件?
    • 如果是、您是否运行了此代码并导致器件每次运行时锁定?

    第二组问题是:

    • 如果您能够加载程序、您在执行什么操作来提示该错误?
    • 您是否在重置后尝试重新连接到内核而不中断调试会话?
    • 您是否能够访问任何器件寄存器?

    我获得的有关这些内容的信息越多、我就越有可能在这里帮助指导您找到解决方案。

    此致、

    Ralph Jacobi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

     

     Jacobi、

    [引用 userid="189615" URL"~μ C/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum1108599/tm4c1294kcpdt-watchdog-timer-tm4c1294kcpdt/4108555#4108555"]您可以将项目加载到任何器件中吗? 如果是、请参阅第二组问题。

    是的、我可以将项目下载到器件中。

    我的目标是将看门狗计时器概念添加到我的应用代码中 以重置器件。 添加这样的内容后,看门狗中断每隔一秒清除一次。当我尝试通过阻止看门狗中断清除来重置设备时,请将其设置为变量 Zero。因为 该时间会出现上面提到的错误。

    [~引语 userid="189615" URL"/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1108599/tm4c1294kcpdt-watchdog-timer-tm4c1294kcpdt/4108555#4108555"]
    • 如果您能够加载程序、您在执行什么操作来提示该错误?
    • 您是否在重置后尝试重新连接到内核而不中断调试会话?
    • 您是否能够访问任何器件寄存器?
    [/报价]

    我可以加载程序。 重置后多次尝试重新连接设备,但强制 阻止看门狗计时器中断清除收到错误而不是设备重置。

    此致、

    Rani

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Rani、

    因此、当器件通过看门狗复位时、整个 JTAG 也会复位、这会切断与 IDE 的连接。 您必须通过右键单击内核并选择连接目标来手动重新连接:

    有时、您必须执行两次才能完全重新建立调试连接。

    此致、

    Ralph Jacobi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,Jacobi,

      在调试模式下,如果我指定重新连接目标工作正常。  在运行 模式(不带调试器)的情况下,看门狗计时器会被复位,会发生什么情况? 目标将自动重新连接? 从 main 开始执行的程序?

    此致、

    Rani  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Rani、

    看门狗复位将从主程序重新启动。

    此致、

    Ralph Jacobi