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.

DSP6678在跑BIOS操作系统时,进入不了Timer中断

Other Parts Discussed in Thread: TMS320C6678

你好,本人在核7中跑BIOS系统,想使用一个定时器,但是按照如下设置,定时器无法进入,希望可以指导一下,感谢。

定时器设置如下图所示:

系统中Isr_Timer定时器代码如下:

static uint32_t g_TimerCnt=0;
Void Isr_Timer(Uint32 arg0)
{
	g_TimerCnt++;
}

Isr_Timer程序初始化:

	IntrCfg g_intrCfg[] =
	{
			{0,core7, CSL_INTC_VECTID_4, timer0_7L, 0xff,
					Isr_Timer,NULL},
	};

        ......

	status = InterruptInit(g_intrCfg,sizeof(g_intrCfg));
	printf("Timer interrupt init status : %d.\n",status);

  • 看一下timer counter寄存器是否开始计数。我这边测试一下看看。

  • 你好,

    感谢你的回复。

    1.我没有看到Timer寄存器中开始计数,按照我通过cfg文件对定时器的设置方法,是否还需要调用函数开启或进行其他设置。

    2.另外我也通过其它库的接口函数进行定时器的初始化,代码如下,使用该该方法后,我的中断服务函数Isr_Timer是可以正常进入的,但由于我的操作系统里面主体功能使用了带有协议栈的UDP通信,使用该方法后我的UDP就不能正常使用,不知为何 。问题定位后,发现只要禁用

    status = InterruptInit(g_intrCfg,sizeof(g_intrCfg));这个功能,我的UDP通信就正常了。

    	//中断
    	IntrCfg g_intrCfg[] =
    	{
    			{0,core7, CSL_INTC_VECTID_4, timer0_7L, 0xff,
    					Isr_Timer,NULL},
    	};
    
    	//定时器初始化
    	C6678_Timer_Init();
    
    	/*设置定时器编号和定时器周期(2秒)*/
    	if(C6678_GP_Timer_Set(7,1000))
    	{
    		printf("Timer7 init success!\n");
    	}
    	else
    	{
    		printf("Timer7 init error!\n");
    	}
    
    	status = InterruptInit(g_intrCfg,sizeof(g_intrCfg));
    	printf("Timer1 interrupt init status : %d.\n",status);
    
    	C6678_Timer_Start(7,1);
    
            ......
    

  • 应该是不需要做额外的配置的,我配置了一下,选的timer ANY,是可以进入中断的。
  • 你好,中断服务程序放在哪里呢,是否需要用extern引用?目前我是放在和main函数同一个.c中,但是发现断点是不能设置,断点处有黄色感叹号。断点处显示如下图,不知道是否和这个有关系。

    另外我现在Timer ID也设置为ANY了,定时器中断还是不能进入。

  • 你打开view->breakpoints看一下有没有该断点选项,你前面灰色的标志断点没打上。

    不需要加extern,可以放在一个c文件下。

  • 断点的问题现在解决了,然后我修改了程序,在主任务最开始的地方直接while(1),目的是为了把其他程序都屏蔽掉来测试定时器,但是这样仍然进不了。有点黔驴技穷了。

  • 我导入了一个clock例程,然后在这个例程的基础上配置了一下,试一下。

    https://e2echina.ti.com/cfs-file/__key/communityserver-discussions-components-files/53/4861.clock_5F00_TMS320C6678.7z

  • 或者直接在代码中动态创建。
    /* Configure a periodic interrupt using any available Timer
    * with a 1000 microsecond (1ms) interrupt period.
    *
    * The Timer interrupt will be handled by 'hwiFxn' which
    * will run as a Hwi thread.
    */
    timerParams.period = 1000;
    timer = Timer_create(Timer_ANY, hwiFxn, &timerParams, &eb);
    if (timer == NULL) {
    System_abort("Timer create failed");
    www.ti.com/.../spruex3u.pdf
  • 你好,现在我的定时器可以正常使用了,但是我好像并没有修改什么实质性的内容,定时器的设置还是这样设置的,在后面的使用中我会继续关注一下这次遇到的问题,最后,感谢你的回复,谢谢。