首先基本需求:5倍采样接收端原始比特数据
基本配置:868MHz,5kbps,15k dev,49k BW,使用例程rfEasyLinkRx_CC1310_LAUNCHXL_tirtos和rfEasyLinkTx_CC1310_LAUNCHXL_tirtos做测试,接收端DIO22配置连接到MCE_GPO1(Binary data signal that comes from the demodulator when receiving)
操作过程:进入接收后开启定时器,定时周期为40us以实现对DIO22的25k的采样
结果:
1.接收端输出的原始比特数据与发送的数据是取反的关系,而且占空比偏差大,如下图所示
图中黄色是发送端输出的比特数据,下面蓝色是接收端输出的比特数据,两者取反关系,而且发送端前面发送的是01的前导码,接收端输出的波形并非严格的50%占空比(高250us,低150us),发射功率12dBm,两测试板非常靠近,不仅是开始的前导码,即便是后面的数据也是如此。
Q1:为什么会这样,有办法让接收端输出规则的比特数据吗?
2.定时器定时设置为40us,结果完全不准,10-50us的都有,但如果把定时设置为1ms以上就比较准但满足不了采样要求,设置为10us也非常准,但此时接收端却不会输出比特数据了???,定时器配置如下:
void timerCallback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask)
{
// interrupt callback code goes here. Minimize processing in interrupt.
PIN_setOutputValue(pinHandle, Board_PIN_LED2,!PIN_getOutputValue(Board_PIN_LED2));
//SampleData(PIN_getOutputValue(Board_DIO22));
}
{
// interrupt callback code goes here. Minimize processing in interrupt.
PIN_setOutputValue(pinHandle, Board_PIN_LED2,!PIN_getOutputValue(Board_PIN_LED2));
//SampleData(PIN_getOutputValue(Board_DIO22));
}
void timerSetup(void)
{
GPTimerCC26XX_Params params;
GPTimerCC26XX_Params_init(¶ms);
params.width = GPT_CONFIG_16BIT;
params.mode = GPT_MODE_PERIODIC_UP;
params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
hTimer = GPTimerCC26XX_open(GPT_A, ¶ms);
if (hTimer == NULL)
{
System_abort("Failed to open GPTimer");
}
{
GPTimerCC26XX_Params params;
GPTimerCC26XX_Params_init(¶ms);
params.width = GPT_CONFIG_16BIT;
params.mode = GPT_MODE_PERIODIC_UP;
params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
hTimer = GPTimerCC26XX_open(GPT_A, ¶ms);
if (hTimer == NULL)
{
System_abort("Failed to open GPTimer");
}
Types_FreqHz freq;
BIOS_getCpuFreq(&freq);
GPTimerCC26XX_Value loadVal = freq.lo / 25000 – 1; //47999
GPTimerCC26XX_setLoadValue(hTimer, loadVal);
GPTimerCC26XX_registerInterrupt(hTimer, timerCallback, GPT_INT_TIMEOUT);
BIOS_getCpuFreq(&freq);
GPTimerCC26XX_Value loadVal = freq.lo / 25000 – 1; //47999
GPTimerCC26XX_setLoadValue(hTimer, loadVal);
GPTimerCC26XX_registerInterrupt(hTimer, timerCallback, GPT_INT_TIMEOUT);
GPTimerCC26XX_start(hTimer);
}
}
Q2:如何配置定时器让其满足采样的要求或有没有类似的机制能满足采样的要求?
mingfeng fan:
我也遇到高频定时不准问题,怎么解决?