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.

[参考译文] LAUNCHXL-CC1352R1:较高频率下捕获的时间差不准确

Guru**** 2462530 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1223718/launchxl-cc1352r1-captured-time-difference-is-not-accurate-for-higher-frequencies

器件型号:LAUNCHXL-CC1352R1
while (1)
//检查是否生成了捕获
if (interrupt_flag > 0){
if (interrupt_flag == 1){
CaptureTime_1 = GPTMERCC26XX_getValue (timerHandle);//首次捕获
}
if (interrupt_flag == 2){
CaptureTime_2 = GPTMERCC26XX_getValue (timerHandle);//第二次捕获
timeDifference =(65535 *溢出+ CaptureTime_2)- CaptureTime1;//取得时差
printf ("时间差:%d\n"、timeDifference);//调试

//重置全局变量
INTERRUPT_FLAG = 0
溢出= 0
}
GPTimerCC26xx_start (timerHandle);//启动计时器
}
}
 

void timerCallback (GPTimerCC26XX_Handle timerHandleint_fast16_t status){
overflow++;//更新溢出
}

void gpioInterruptHandler (uint_least8_t index){
interrupt_flag++;//更新 interrupt_flag
GPTimerCC26xx_stop (timerHandle);//停止计时器
}
下面是通过使用内置库 GPTimerCC26xx.h 访问定时器当前值来获得输入捕获的代码实现 使用 GPIO.h 库对 GPIO 使用常用配置。 遗憾的是、此实现提供的捕获不准确、从而导致出现错误的 时间差。 使用的标头函数是否存在限制?  

谢谢!  
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    cvfab、您好!  

    您看到的错误是什么? 您可能会从使用信标或事件中受益。  如果有2个 GPIO 中断等情况、似乎没有正确处理。 在这种情况下、启动和停止计时器逻辑可能不同步。  

    此致、

    SID