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

CC1310: 关于rfEchoRx和rfEchoTx例程遇到的问题

Part Number:CC1310

我在原例程的基础上修改了下LED对应的IO,一个板子运行Tx例程,另一块板运行Rx例程,经过调试发现Rx例程的板子接收到数据后一直不回复,smartrf_setting里的内容也没动,然后我就把Rx的那块板子测试了下rfPacketTx例程,发现发送没有问题,请问这是哪出问题了导致一直不回复数据。一下是Rx的代码:

void *mainThread(void *arg0)
{
RF_Params rfParams;
RF_Params_init(&rfParams);

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

if( RFQueue_defineQueue(&dataQueue,
rxDataEntryBuffer,
sizeof(rxDataEntryBuffer),
NUM_DATA_ENTRIES,
PAYLOAD_LENGTH + NUM_APPENDED_BYTES))
{
/* Failed to allocate space for all data entries */
// PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 1);
// PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, 1);
while(1);
}

/* Modify CMD_PROP_TX and CMD_PROP_RX commands for application needs */
/* Set the Data Entity queue for received data */
RF_cmdPropRx.pQueue = &dataQueue;
/* Discard ignored packets from Rx queue */
RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1;
/* Discard packets with CRC error from Rx queue */
RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1;
/* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
RF_cmdPropRx.maxPktLen = PAYLOAD_LENGTH;
/* End RX operation when a packet is received correctly and move on to the
* next command in the chain */
RF_cmdPropRx.pktConf.bRepeatOk = 0;
RF_cmdPropRx.pktConf.bRepeatNok = 1;
RF_cmdPropRx.startTrigger.triggerType = TRIG_NOW;
RF_cmdPropRx.pNextOp = (rfc_radioOp_t *)&RF_cmdPropTx;
/* Only run the TX command if RX is successful */
RF_cmdPropRx.condition.rule = COND_STOP_ON_FALSE;
RF_cmdPropRx.pOutput = (uint8_t *)&rxStatistics;

RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
RF_cmdPropTx.pPkt = txPacket;
RF_cmdPropTx.startTrigger.triggerType = TRIG_REL_PREVEND;
RF_cmdPropTx.startTime = TX_DELAY;

/* 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_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);

while(1)
{
/* Wait for a packet
* – When the first of the two chained commands (RX) completes, the
* RF_EventCmdDone and RF_EventRxEntryDone events are raised on a
* successful packet reception, and then the next command in the chain
* (TX) is run
* – If the RF core runs into an issue after receiving the packet
* incorrectly onlt the RF_EventCmdDone event is raised; this is an
* error condition
* – If the RF core successfully echos the received packet the RF core
* should raise the RF_EventLastCmdDone event
*/
RF_EventMask terminationReason =
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal,
echoCallback, (RF_EventRxEntryDone |
RF_EventLastCmdDone));

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_cmdPropRx)->status;
switch(cmdStatus)
{
case PROP_DONE_OK:
// Packet received with CRC OK
break;
case PROP_DONE_RXERR:
// Packet received with CRC error
break;
case PROP_DONE_RXTIMEOUT:
// Observed end trigger while in sync search
break;
case PROP_DONE_BREAK:
// Observed end trigger while receiving packet when the command is
// configured with endType set to 1
break;
case PROP_DONE_ENDED:
// Received packet after having observed the end trigger; if the
// command is configured with endType set to 0, the end trigger
// will not terminate an ongoing reception
break;
case PROP_DONE_STOPPED:
// received CMD_STOP after command started and, if sync found,
// packet is received
break;
case PROP_DONE_ABORT:
// Received CMD_ABORT after command started
break;
case PROP_ERROR_RXBUF:
// No RX buffer large enough for the received data available at
// the start of a packet
break;
case PROP_ERROR_RXFULL:
// Out of RX buffer space during reception in a partial read
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_RXOVF:
// RX overflow observed during operation
break;
default:
// Uncaught error event – these could come from the
// pool of states defined in rf_mailbox.h
while(1);
}
}
}

static void echoCallback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{
#ifdef LOG_RADIO_EVENTS
eventLog[evIndex++ & 0x1F] = e;
#endif// LOG_RADIO_EVENTS

if (e & RF_EventRxEntryDone)
{
/* Successful RX */
/* Toggle LED2, clear LED1 to indicate RX */
//PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 0);
PIN_setOutputValue(ledPinHandle, Board_PIN_LED2,
!PIN_getOutputValue(Board_PIN_LED2));

/* Get current unhandled data entry */
currentDataEntry = RFQueue_getDataEntry();

/* Handle the packet data, located at &currentDataEntry->data:
* – Length is the first byte with the current configuration
* – Data starts from the second byte */
packetLength = *(uint8_t *)(&(currentDataEntry->data));
packetDataPointer = (uint8_t *)(&(currentDataEntry->data) + 1);

/* Copy the payload + status byte to the rxPacket variable, and then
* over to the txPacket
*/
memcpy(txPacket, packetDataPointer, packetLength);

RFQueue_nextEntry();
}
else if (e & RF_EventLastCmdDone)
{
/* Successful Echo (TX)*/
/* Toggle LED2, clear LED1 to indicate RX */
//PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 0);
PIN_setOutputValue(ledPinHandle, Board_PIN_LED1,
!PIN_getOutputValue(Board_PIN_LED1));

}
else // any uncaught event
{
/* Error Condition: set LED1, clear LED2 */
// PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 1);
// PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, 0);
}
}

?? ?:

今天调试发现RF_cmdPropTx的状态字节为0x801,但是开始触发参数完全是按照例程走的,不应该有这种问题啊

,

Alex Zhang:

您好,您这边是ti的开发板还是自行设计的硬件。另外请提供一下sdk版本号

,

?? ?:

自己做的板子,simplelink_cc13x0_sdk_4_20_02_07

,

?? ?:

我用其他的例程都测试过了,基本上都能正常运行,唯独这个例程运行有问题

,

Alex Zhang:

您好,您这边是否有官方的开发板去进行现如今这个有问题的demo测试,我这边想确定是否硬件问题

您这边可以先从我提供的思路确定问题

如果不是硬件设计问题

我们这边在进行软件方向的解决

如果是硬件设计问题的话

麻烦您可以在以下链接申请相应的硬件审核:SIMPLELINK-2-4GHZ-DESIGN-REVIEWS,有专业的硬件工程师帮您查看相应硬件问题。

,

?? ?:

您好,我手里暂时没有官方开发板,但是我已经用其他例程验证过硬件应该是没有问题的,可以正常发送或者接收,还有其他的例程我都测试了没有问题,所以我怀疑是软件的问题,我上面贴出的代码就是例程里的源码,您能帮我看下是否有问题?

,

Alex Zhang:

您这边都做了哪些修改?

,

Alex Zhang:

您这边可以在代码中标注出来吗

,

?? ?:

您好,我只是更改了下LED 的IO口配置,mainThread里一共有2处更改:

1. ledPinHandle = PIN_open(&ledPinState, pinTable);    //更改IO配置

2. PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, !PIN_getOutputValue(Board_PIN_LED2)); //更改IO口

其他关于命令的配置完全没有修改,无非就是注释了几条LED状态切换函数。

另外   #define      TX_DELAY             (uint32_t)(4000000*0.1f)发送延迟时间我尝试调大也不行

,

Alex Zhang:

您好,我这边需要时间来看一下代码

,

Alex Zhang:

?? ? said:

您好,我只是更改了下LED 的IO口配置,mainThread里一共有2处更改:

1. ledPinHandle = PIN_open(&ledPinState, pinTable);    //更改IO配置

2. PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, !PIN_getOutputValue(Board_PIN_LED2)); //更改IO口

其他关于命令的配置完全没有修改,无非就是注释了几条LED状态切换函数。

另外   #define      TX_DELAY             (uint32_t)(4000000*0.1f)发送延迟时间我尝试调大也不行

您好,如果直接去跑这个例程,您这边不去修改的话,是否会有问题。

赞(0)
未经允许不得转载:TI中文支持网 » CC1310: 关于rfEchoRx和rfEchoTx例程遇到的问题
分享到: 更多 (0)