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

LAUNCHXL-CC1310: CC1310 TIMER+RF同时使用时,RF不能工作

Part Number:LAUNCHXL-CC1310Other Parts Discussed in Thread:CC1350

为了能够精确在每200ms发送一次数据,我采用了TIMER进行定时,然后再主程序中进行radio发送。现在问题是:

1)单独的TIMER程序测试没有问题,通过GPIO电平翻转,可以测试到约200ms翻转;

2)单独的射频发送测试没有问题, 另外一块开发板可以正常接收数据;

3)将两个合并使用时,则定时器中断可以正常进入;但是射频发送无法进行。

请问,是TIMER的使用与RADIO发送冲突了吗?还是使用方法不对导致的?

void rf_init()
{
RF_Params rfParams;
RF_Params_init(&rfParams);

#ifdef POWER_MEASUREMENT
#if defined(Board_CC1350_LAUNCHXL)
/* Route out PA active pin to Board_DIO30_SWPWR */
PINCC26XX_setMux(ledPinHandle, Board_DIO30_SWPWR, PINCC26XX_MUX_RFC_GPO1);
#endif
#endif

/* Request access to the radio */
#if defined(DeviceFamily_CC26X0R2)
rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioSetup, &rfParams);
#else
rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
#endif// DeviceFamily_CC26X0R2

/* Set the frequency */
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
}

void rf_tx()
{
rf_init();
// packetInterval = (uint32_t)(RF_convertMsToRatTicks(PKT_INTERVAL_MS_CUSTOM)); // Set packet interval to 60 ms
// usleep(PACKET_INTERVAL);
RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
RF_cmdPropTx.pPkt = packet;
RF_cmdPropTx.startTrigger.triggerType = TRIG_NOW;
// time = RF_getCurrentTime();
// RF_cmdPropTx.startTrigger.pastTrig = 1;

// while(1)
// {
/* Create packet with incrementing sequence number and random payload */
packet[0] = (uint8_t)(seqNumber >> 8);
packet[1] = (uint8_t)(seqNumber++);
uint8_t i;
for (i = 2; i < PAYLOAD_LENGTH; i++)
{
packet[i] = i;//rand();
}
// RF_cmdPropTx.startTime = time;

/* Send packet */
RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx,
RF_PriorityNormal, NULL, 0);

switch(terminationReason)
{
case RF_EventLastCmdDone:
// A stand-alone radio operation command or the last radio
// operation command in a chain finished.
break;
case RF_EventCmdCancelled:
// Command cancelled before it was started; it can be caused
// by RF_cancelCmd() or RF_flushCmd().
break;
case RF_EventCmdAborted:
// Abrupt command termination caused by RF_cancelCmd() or
// RF_flushCmd().
break;
case RF_EventCmdStopped:
// Graceful command termination caused by RF_cancelCmd() or
// RF_flushCmd().
break;
default:
// Uncaught error event
while(1);
}

uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdPropTx)->status;
switch(cmdStatus)
{
case PROP_DONE_OK:
// Packet transmitted successfully
break;
case PROP_DONE_STOPPED:
// received CMD_STOP while transmitting packet and finished
// transmitting packet
break;
case PROP_DONE_ABORT:
// Received CMD_ABORT while transmitting packet
break;
case PROP_ERROR_PAR:
// Observed illegal parameter
break;
case PROP_ERROR_NO_SETUP:
// Command sent without setting up the radio in a supported
// mode using CMD_PROP_RADIO_SETUP or CMD_RADIO_SETUP
break;
case PROP_ERROR_NO_FS:
// Command sent without the synthesizer being programmed
break;
case PROP_ERROR_TXUNF:
// TX underflow observed during operation
break;
default:
// Uncaught error event – these could come from the
// pool of states defined in rf_mailbox.h
while(1);
}

#ifndef POWER_MEASUREMENT
PIN_setOutputValue(ledPinHandle, Board_PIN_LED1,!PIN_getOutputValue(Board_PIN_LED1));
#endif
/* Power down the radio */
// RF_yield(rfHandle);

#ifdef POWER_MEASUREMENT
/* Sleep for PACKET_INTERVAL s */
sleep(PACKET_INTERVAL);
#else
/* Sleep for PACKET_INTERVAL us */
// usleep(PACKET_INTERVAL);
#endif
// }
}

void timerCallback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask) {

// interrupt callback code goes here. Minimize processing in interrupt.
if (repeat_timer_count == 0)
rf_tx();
repeat_timer_count = (repeat_timer_count + 1) % 200;

}

void repeat_timer() {
GPTimerCC26XX_Handle hTimer;
GPTimerCC26XX_Params params;
GPTimerCC26XX_Params_init(&params);
params.width = GPT_CONFIG_16BIT;
params.mode = GPT_MODE_PERIODIC;
params.direction = GPTimerCC26XX_DIRECTION_UP;
params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
hTimer = GPTimerCC26XX_open(Board_GPTIMER0A, &params);
if(hTimer == NULL) {
while (1);
}

// Types_FreqHz freq;
// BIOS_getCpuFreq(&freq);
GPTimerCC26XX_Value loadVal = 47999; //freq.lo / 1000 – 1; //47999
GPTimerCC26XX_setLoadValue(hTimer, loadVal);
GPTimerCC26XX_registerInterrupt(hTimer, timerCallback, GPT_INT_TIMEOUT);

GPTimerCC26XX_start(hTimer);

}

void *mainThread(void *arg0)
{
/* Open LED pins */
ledPinHandle = PIN_open(&ledPinState, pinTable);
if (ledPinHandle == NULL)
{
while(1);
}
repeat_timer();
}

Kevin Qiu1:

回调函数timerCallback中不应有任何形式的阻塞, rf_init()中的RF_runCmd就是阻塞的,将其替换为 RF_postCmd试试

也可以使用Wake-on-Radio例程实现200ms发送

,

leo liu:

RF_postCmd 试过了,也是一样的,RF不能发送

,

Kevin Qiu1:

debug程序,看具体卡在哪里

,

leo liu:

卡在RF_postCmd 给RF下发packet时

,

Kevin Qiu1:

那可能就是因为回调函数的原因,需要从回调函数中移出来

,

leo liu:

没太理解,RF下发Packet的回调设置的NULL,单步debug 通过postcmd下发packet,全部正常执行,但是就是只运行一次,跟runcmd现象一样

,

Kevin Qiu1:

只能运行一次确实比较奇怪,参考下面的文档做一些调试,看一下任务具体运行情况:

https://dev.ti.com/tirex/content/simplelink_cc13x0_sdk_4_20_01_03/docs/proprietary-rf/proprietary-rf-users-guide/proprietary-rf-guide/debugging-index.html

https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_1GHz_node

赞(0)
未经允许不得转载:TI中文支持网 » LAUNCHXL-CC1310: CC1310 TIMER+RF同时使用时,RF不能工作
分享到: 更多 (0)

© 2024 TI中文支持网   网站地图 鲁ICP备2022002796号-1