Thread 中讨论的其他器件:SYSBIOS
您好!
我们正在处理 Beagle Bone Black,并尝试使用 Timer_create()创建计时器,但调用会被阻止,程序计数器永远不会从该调用中退出,同时进行分步调试。
这是我们使用的代码片段:
(
空 timer0Initialize (空)
{
ERROR_INIT (&EB);
CONSOLEUtilsPrintf ("正在初始化计时器0!!!\n");
Timer_Params_init (&timerParams);
/*定时器周期加载52微秒*/
timer0ISRtime(52);
timerParams.period = timerDelay;
timerParams.extFreq.hi = 0;
timerParams.extFreq.lo = 24000000;// BBB xtal freq
timerParams.periodType = Timer_PeriodType_micros;
timerParams.startMode = Timer_StartMode_user;
timerParams.runMode = Timer_RunMode_Continuous;
timerParams.arg = 1;
CONSOLEUtilsPrintf ("创建定时器并安装 ISR\n");
/*创建并启用计时器中断*/
timer0 = Timer_create (2、timer0ISR、&timerParams、&EB);
if (timer0 ==空)
{
CONSOLEUtilsPrintf ("计时器创建失败:%s"、eb.msg);
System_abort ("计时器创建失败");
}
CONSOLEUtilsPrintf ("定时器初始化已完成\n");
}
(二
这是我们 cfg 文件的内容:
(二
VAR 默认值= xdc.useModule('xdc.runtime.Defaults');
VAR 诊断= xdc.useModule('xdc.runtime.Diags');
VAR 错误= xdc.useModule('xdc.runtime.Error');
VAR Main = xdc.useModule('xdc.runtime.Main');
VAR 内存= xdc.useModule('xdc.runtime.Memory')
VAR SysMin = xdc.useModule('xdc.runtime.SysMin');
VAR 系统= xdc.useModule('xdc.runtime.System');
var text = xdc.useModule('xdc.runtime.Text');
VAR 时钟= xdc.useModule('ti.sysbios.knl.Clock');
VAR Swi = xdc.useModule('ti.sysbios.knl.Swi');
VAR 任务= xdc.useModule('ti.sysbios.knl.Task');
VAR 信标= xdc.useModule('ti.sysbios.knl.Semaphore');
VAR Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
//var 计时器= xdc.useModule('ti.sysbios.hal.Timer');
VAR 计时器= xdc.useModule('ti.sysbios.timers.dmtimer.Timer')
VAR HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
(二
可以看到、我们使用的是 DM 计时器。
相同的代码以前工作过、但现在该代码突然停止工作。
请告诉我们为什么 Timer_create()调用被阻止,以及如何将计时器实例2用于计时目的。
谢谢。