在用CC1310的GPTimer做串口接收超时判断,当有串口数据时需要在串口回调里面不断清除计数器的值。如果在初始化的时候我设置
tparams.mode = GPT_MODE_ONESHOT_UP;
GPTimerCC26XX_setLoadValue(hTimer, 47999999);
我发现没有专门的定时器清零API,如果在串口回调里面GPTimerCC26XX_setLoadValue(hTimer, 0);那么定时器不得一直中断了?请问这个问题该怎么解决。
Viki Shi:
确实,目前没有API来清零GPTimer,你可以参考下右边帖子的做法: e2e.ti.com/…/722625
user4959119:
回复 Viki Shi:
好DT啊,参考帖子是通过操作寄存器实现的吧?我看了手册怎么还分定时器AB呢,我随便创建了一个怎么判断属于哪个?
Viki Shi:
回复 user4959119:
The GPTimer can be used in two different configurations. In 32-bit mode the timer will act as a full-width timer and is controlled using the Timer A unit. In split (16-bit) mode the timer is split into 2x 16-bit timers. In 16-bit mode a prescaler is available for each timer unit, effectively increasing the resolution in this mode to 24-bit. All supported modes by driver in split configuration uses prescaler as timer extension.
参见: dev.ti.com/…/GPTimerCC26XX.html
user4959119:
回复 Viki Shi:
我用寄存器方式给定时器A清0貌似不太管事,看一下有什么错误吗?
HWREG(hTimer->hwAttrs->baseAddr+ GPT_O_TAV) = 0;