TI中文支持网
TI专业的中文技术问题搜集分享网站

CC2640R2F: CC2640R2F GPTimer使用

Part Number:CC2640R2F

GPTimer采用边沿计时模式,请问GPTimerCC26XX_getValue()函数和GPTimerCC26XX_getFreeRunValue() 函数有什么区别?

Kevin Qiu1:

看下这里的解释

/*!*@briefFunction to retrieve the current free-running value of timer**@preGPTimerCC26XX_open() has to be called first successfully**@paramhandle A GPTimerCC26XX handle returned from GPTimerCC26XX_open**@return Current free-running timer value for all modes**@saGPTimerCC26XX_open()*/
extern GPTimerCC26XX_Value GPTimerCC26XX_getFreeRunValue(GPTimerCC26XX_Handle handle);/*!*@briefFunction to retrieve the current value of timer*This returns the value of the timer in all modes except for*input edge count and input edge time mode.*In edge count mode, this register contains the number of edges that*have occurred. In input edge time, this register contains the*timer value at which the last edge event took place.***@preGPTimerCC26XX_open() has to be called first successfully**@paramhandle A GPTimerCC26XX handle returned from GPTimerCC26XX_open**@return Current free-running timer value for all modes**@saGPTimerCC26XX_open()*/
extern GPTimerCC26XX_Value GPTimerCC26XX_getValue(GPTimerCC26XX_Handle handle);

,

梦与远方:

GPTimerCC26XX_getValue()返回的是边沿触发时的值,GPTimerCC26XX_getFreeRunValue() 返回的是GPTimer的实时值,那么我可以用这两个数相减来做比较吗?用来确认处理中断时,GPTimer当前值和边沿触发时的值的间隔

,

Kevin Qiu1:

在边沿计数模式下GPTimerCC26XX_getValue获取的是边沿数

在GPT_MODE_EDGE_TIME 模式返回的才是最后一个边沿事件发生时的定时器值

梦与远方 说:那么我可以用这两个数相减来做比较吗?

你可以试一下

,

梦与远方:

试过了,好像不行,请问要怎么提高GPTimer的中断优先级呀?或者禁止所有的系统中断

,

梦与远方:

测试过了。不行,请问我要怎么提高GPTimer的中断优先级?或者我想在GPT的中断处理函数中关闭其他所有的中断,要怎么做?

,

Kevin Qiu1:

还是之前说过的,最好先单独测试数据采集,确定通过蓝牙发送前的采集数据是否正确,要先确定是采集的问题还是发送的问题

梦与远方 说:我想在GPT的中断处理函数中关闭其他所有的中断,要怎么做?

Swi_disable();  Hwi_disable();

,

梦与远方:

已经确定过了,是采集的问题。蓝牙发送是没有问题的,数据变化的时候校验位也跟着变化了。

,

梦与远方:

我在GPTimer中断处理函数中最开始的位置调用Swi_disable(); Hwi_disable();用来关闭所有的中断,然后执行中断处理,处理完成后再末尾位置调用Swi_enable(); Hwi_enable();单步调试的时候没有问题,全速运行的时候会卡死在Hwi_enable();这个位置,这是哪里的问题?是因为全速执行的时候速度太快了吗?

,

Kevin Qiu1:

Hwi_disable()是关闭所有硬件中断,GPT也被关闭了,只使用Swi_disable()试试

,

梦与远方:

在中断函数中调用Swi_disable(),在中断末尾调用Swi_enable(),手机app会搜索不到蓝牙模块

,

梦与远方:

如何调整GPTimer和BLE蓝牙服务的优先级?

,

Kevin Qiu1:

GPT优先级修改下面intPriority 的值,BLE只有一个任务,优先级是1

// Task configuration#define SP_TASK_PRIORITY 1

const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMERPARTSCOUNT] = {{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },{ .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },{ .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },{ .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },{ .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
};

,

梦与远方:

SDK版本4.30,您说的修改的位置,是在什么地方?GPTimerCC26XX.h文件里没有呀

,

Kevin Qiu1:

在CC2640R2_LAUNCHXL.c中,也可以搜索查看

,

梦与远方:

我的项目工程里没有CC2640R2_LAUNCHXL.c文件,需要将CC2640R2_LAUNCHXL.c加入到项目工程中吗?

,

Kevin Qiu1:

在SDK C:\ti\simplelink_cc2640r2_sdk_5_10_00_02\source\ti\boards\CC2640R2_LAUNCHXL中将

CC2640R2_LAUNCHXL.c和CC2640R2_LAUNCHXL.h复制到workspace工程Application文件夹下

,

梦与远方:

复制过去之后,要添加到工程里面吗?我将CC2640R2_LAUNCHXL.c和CC2640R2_LAUNCHXL.h添加到项目中的Application文件夹下,编译报错,诸如:duplicate dedfinitions for "ADCBuf_count"之类的。另外就是#define SP_TASK_PRIORITY 1在哪个文件里,全局搜索没有找到

,

Kevin Qiu1:

SP_TASK_PRIORITY在simple_peripheral.c中

报错的要改一些文件路径配置,那先不要复制了,直接在C:\ti\simplelink_cc2640r2_sdk_5_10_00_02\source\ti\boards\CC2640R2_LAUNCHXL的CC2640R2_LAUNCHXL.c中修改,记得测完成后将优先级还原到默认值,否则整个SDK中的例程优先级都会改变

,

梦与远方:

我直接改就行了是吗?不用将文件添加到工程中对吧?

,

Kevin Qiu1:

是的

,

梦与远方:

好的,那我先试一下

赞(0)
未经允许不得转载:TI中文支持网 » CC2640R2F: CC2640R2F GPTimer使用
分享到: 更多 (0)