Part Number:AM5718Other Parts Discussed in Thread: SYSBIOS
AM5718的DSP核同时使用Timer5和Timer6时,定时器6中断不稳定。
情况如下:
使用Timer6回调函数时,回调函数进入的频率不是设置的频率,但偶尔是正确的。
使用Timer5是正确的。
Timer6回调函数调用Clock_Tick,在任务中每秒打印一次Clock_getTicks(),而从某一时刻开始,定时器触发频率就不稳定了,以下是我调试定时器的过程:
[ 28.000] led 28000…
[ 29.000] led 29000…
[ 30.000] led 30000…
[ 31.000] led 31000…
[ 32.000] led 32000…
[ 33.000] led 33000…
[ 34.000] led 34000…
[ 35.000] led 35000…
[ 36.000] led 36000…
[ 37.000] led 37000…
[ 38.000] led 38000…
[ 39.000] led 39000…
[ 40.000] led 40000…
[ 41.000] led 41000…
[ 42.000] led 42000…
[ 43.000] led 43000…
[ 44.003] led 44003…
[ 45.005] led 45005…
[ 46.007] led 46007…
[ 47.009] led 47009…
[ 48.011] led 48011…
[ 49.013] led 49013…
[ 50.015] led 50015…
[ 51.017] led 51017…
[ 52.019] led 52019…
[ 53.021] led 53021…
[ 54.023] led 54023…
[ 55.025] led 55025…
[ 56.027] led 56027…
[ 57.029] led 57029…
[ 58.031] led 58031…
[ 59.033] led 59033…
[ 60.035] led 60035…
在论坛上已参考:
https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_DSP_TimerSupport.html
https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_DSP_2662506
http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/sysbios/6_40_01_15/exports/bios_6_40_01_15/docs/cdoc/ti/sysbios/timers/dmtimer/doc-files/TimerTables.html
https://e2e.ti.com/support/processors-group/processors/f/processors-forum/634017/rtos-am5728-timer-control-from-dsp
问题:
1、怎样使定时器稳定触发?
2、AM5718可以使用几个定时器?
Shine:
请问是自己的板子还是EVM板?SDK是哪个版本?
,
hongyou lu:
自己的板子,SDK是am57xx_06_03_02_08
,
Shine:
请问单独使用timer6正确吗?
,
hongyou lu:
单独不正确,而且DSP的cfg文件除了timer5和6能配置,其他定时器使用的话编译会提示不能使用
,
Shine:
能否把timer6的代码配置和timer5一样么?能否把相关代码帖一下。
,
hongyou lu:
这是.cfg的部分代码:
var timer0Params = new Timer.Params();timer0Params.instance.name = "timer0";timer0Params.period = 1000;timer0Params.periodType = xdc.module("ti.sysbios.interfaces.ITimer").PeriodType_MICROSECS;timer0Params.extFreq.lo = 20000000;timer0Params.runMode = xdc.module("ti.sysbios.interfaces.ITimer").RunMode_CONTINUOUS;Program.global.timer0 = Timer.create(4, "&TimerFxn", timer0Params);Clock.tickSource = Clock.TickSource_USER;Clock.tickPeriod = 1000;var timer1Params = new Timer.Params();timer1Params.instance.name = "timer1";timer1Params.period = 1000;timer1Params.periodType = xdc.module("ti.sysbios.interfaces.ITimer").PeriodType_MICROSECS;timer1Params.extFreq.lo = 20000000;timer0Params.runMode = xdc.module("ti.sysbios.interfaces.ITimer").RunMode_CONTINUOUS;Program.global.timer1 = Timer.create(5, "&clockFxn", timer1Params);ti_sysbios_timers_dmtimer_Timer.anyMask = 48;ti_sysbios_timers_dmtimer_Timer.intFreq.lo = 20000000;ti_sysbios_timers_dmtimer_Timer.timerSettings[4].intNum = 12;ti_sysbios_timers_dmtimer_Timer.timerSettings[5].intNum = 13;
这是时钟回调函数:
void clockFxn(UArg arg){ Clock_tick();}
,
Shine:
我把您的问题升级到e2e了,请关注下面帖子的回复。https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1067616/am5728-timer6-can-t-work-stable
,
hongyou lu:
好的,但是我无法在e2e论坛发评论的
,
Shine:
英文e2e上需要公司或者学校的邮箱注册才能发帖。
您可以发在这里,我帮您转发。
,
hongyou lu:
嗯嗯,好的
,
hongyou lu:
论坛那边回复了
1、单独测试过,依然不稳定,并且是时钟并不是偏差几毫秒,而是一瞬间就打印出很多时钟的数据了
2、Clock_tick()是TI-RTOS时钟库函数
,
Shine:
已在英文论坛更新,请关注回复。
,
hongyou lu:
你好,那边帖子已经很久没回复了,您能帮我再问一下吗
,
Shine:
好的,已更新。
,
Shine:
请看下面工程师的回复。Apologies for delay. There is no apparent reason for Timer5 and Timer6 behaving in different manner when both are used in same way. I am trying to reproduce the issue on my end and will soon get back with updates.Meanwhile, can you check if you are seeing similar behavior with any other timer instance?
,
hongyou lu:
我测试使用其他定时器,使用除了Timer0,5,6以外的定时器会导致Linux无法正常工作(或许是我配置的方式不对),而使用Timer0最大频率只能为25971Hz,依然无法稳定输出时钟,也就是说,目前只有一个定时器也就是Timer5在正常工作,当然,这也是所有例程里使用到的定时器。
配置Timer0代码如下,其他定时器类似,只是输入频率不一样(其他的默认20Mhz):
var timer1Params = new Timer.Params(); timer1Params.instance.name = "timer1"; timer1Params.period = 1000; timer1Params.periodType = xdc.module("ti.sysbios.interfaces.ITimer").PeriodType_MICROSECS; timer1Params.runMode = xdc.module("ti.sysbios.interfaces.ITimer").RunMode_CONTINUOUS; timer1Params.extFreq.lo = 25971; Program.global.timer1 = Timer.create(0, "&clockFxn", timer1Params); var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar'); var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport'); TimerSupport.availMask = 0xFFFF;
,
Shine:
已更新,请关注工程师的回复。