Other Parts Discussed in Thread: UNIFLASH, TM4C129DNCPDT
器件型号: TM4C129DNCPDT
Thread 中讨论的其他器件: UNIFLASH
您好:
我正在使用 TivaWare DriverLib 处理基于 TM4C 的工程、遇到了一个问题、即使计时器明显在运行、Timer0A 中断也不会触发。 但不点击 watchdogTimerIsr ()
设置详细信息:
- MCU:TM4C(Tiva C 系列)
- 工具链:Code Composer Studio
- DriverLib 的示例
- 系统时钟:使用进行配置
configSysClock(120000000)并存储在中g_ui32SysClock
计时器配置:
我正在将 Timer0A 配置为每 850ms 生成一个中断:
#define WATCHDOG_TIMER_BASE TIMER0_BASE
#define WATCHDOG_TIMER_PERIPH SYSCTL_PERIPH_TIMER0
#define WATCHDOG_TIMER_INT INT_TIMER0A
#define WATCHDOG_TIMER_SUB Timer_A
static bool s_watchdogTimerRunning = false;
INT aa = 0;
静态 void watchdogTimerIsr (void)
{
TimerClear (WATCHDOG_TIMER_BASE、WATCHDOG_TIMER_SUB);
AA++;
// watchdogCheckIn ();
}
静态 uint32_t watchdogTimerLoadTicks (void)
{
uint32_t sysClock = g_ui32SysClock;
IF (sysClock == 0U)
{
sysClock = SysCtlClockGet ();
}
返回 ((sysClock / 1000U)* 850)- 1U;
}
void watchdogTimerStart (void)
{
#if ! defined(Board_control)
返回;
#else
uint8_t initTry = 0u;
if (s_watchdogTimerRunning)
{
返回;
}
应该做
{
SysCtlPeripheralEnable (WATCHDOG_TIMER_PERIPH);
if (initTry++>= port_init_try_times)
{
返回;
}
SysCtlDelay (g_ui32SysClock/120000U);
}
while(!SysCtlPeripheralReady (watchdog_timer_Periph));
TimerDisable (WATCHDOG_TIMER_BASE、WATCHDOG_TIMER_SUB);
TimerConfigure (WATCHDOG_TIMER_BASE、TIMER_CFG_PERIODENT);
TimerLoadSet (watchdog_timer_base、watchdogTimer_sub、watchdogTimerLoadTicks ());
TimerClear (WATCHDOG_TIMER_BASE、WATCHDOG_TIMER_SUB);
TimerIntEnable (WATCHDOG_TIMER_BASE、TIMER_TIMA_TIMEOUT);
IntDisable (WATCHDOG_TIMER_INT);
IntRegister (WATCHDOG_TIMER_INT、watchdogTimerIsr);
IntEnable (WATCHDOG_TIMER_INT);
// watchdogCheckIn ();
TimerEnable (WATCHDOG_TIMER_BASE、WATCHDOG_TIMER_SUB);
IntMasterEnable();
S_watchdogTimerRunning = true;
#endif
}
void watchdogTimerStop (void)
{
#if ! defined(Board_control)
返回;
#else
if(!s_watchdogTimerRunning)
{
返回;
}
TimerDisable (WATCHDOG_TIMER_BASE、WATCHDOG_TIMER_SUB);
TimerIntDisable (WATCHDOG_TIMER_BASE、TIMER_TIMA_TIMEOUT);
IntDisable (WATCHDOG_TIMER_INT);
S_watchdogTimerRunning = false;
#endif
}