如题,利用tirtos_cc13xx_cc26xx_2_21_00_06例程中RF packetTx进行发射测试,例程中
rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdRadioSetup, &rfParams);
RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdIeeeTx, RF_PriorityNormal, NULL, 0);
其中RF_cmdPropRadioDivSetup、RF_cmdPropTx这些在新生成的smartrf_settings.c文件中变成了RF_cmdRadioSetup、RF_cmdIeeeTx,我把程序改成这样:
static void txTaskFunction(UArg arg0, UArg arg1)
{
uint32_t time;
RF_Params rfParams;
RF_Params_init(&rfParams);
RF_cmdIeeeTx.payloadLen = PAYLOAD_LENGTH;
RF_cmdIeeeTx.pPayload = packet;
// RF_cmdIeeeTx.startTrigger.triggerType = TRIG_ABSTIME;
// RF_cmdIeeeTx.startTrigger.pastTrig = 1;
RF_cmdIeeeTx.startTime = 0;
/* Request access to the radio */
rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdRadioSetup, &rfParams);
/* Set the frequency */
`RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
/* Get current time */
time = RF_getCurrentTime();
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] = rand();
}
/* Set absolute TX time to utilize automatic power management */
time += PACKET_INTERVAL;
RF_cmdIeeeTx.startTime = time;
/* Send packet */
RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdIeeeTx, RF_PriorityNormal, NULL, 0);
if (!(result & RF_EventLastCmdDone))
{
/* Error */
while(1);
}
PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1));
}
}
最后程序总是死在RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdIeeeTx, RF_PriorityNormal, NULL, 0);过不去
求解答,一直用的cc2530走私有协议,刚接触cc2650,不是很懂。折腾了几天了
Viki Shi:
不太清楚你现在用的是什么模式,请看一下这边的例程,里面有相关函数的用法:e2e.ti.com/…/857595
user1938356:
回复 Viki Shi:
我就是想用RF packetTx这个工程发送数据包,然后用smartRF studio7 软件接cc2530进行接收测试,但是默认工程里面射频配置不是基于802.15.4的模式,所以的我接收模块没法收到数据,我想修改配置实现与cc2530的简单收发功能
Viki Shi:
回复 user1938356:
在CC2530上实现basic RF的话,推荐www.ti.com/…/swrc135 里的例程,尤其是swrc135b[1].zip\source\components\radios\cc2530\hal_rf.c
user1938356:
回复 Viki Shi:
CC2530实现basic RF是没问题的,我们的产品都是用的2530走的私有协议,现在新产品想用cc2650替换,所以在用cc2650与2530做收发测试,卡了几天了
user1938356:
回复 Viki Shi:
例程里面的packetTx和packetrx收发我实现了,但不是我想用的rf模式,例程里面的配置如下:
RF_Mode RF_prop =
{.rfMode = RF_MODE_PROPRIETARY_2_4,.cpePatchFxn = &rf_patch_cpe_genfsk,.mcePatchFxn = &rf_patch_mce_genfsk,.rfePatchFxn = &rf_patch_rfe_genfsk,
};
rfc_CMD_PROP_TX_t RF_cmdPropTx =
{.commandNo = 0x3801,.status = 0x0000,.pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx.startTime = 0x00000000,.startTrigger.triggerType = 0x0,.startTrigger.bEnaCmd = 0x0,.startTrigger.triggerNo = 0x0,.startTrigger.pastTrig = 0x0,.condition.rule = 0x1,.condition.nSkip = 0x0,.pktConf.bFsOff = 0x0,.pktConf.bUseCrc = 0x1,.pktConf.bVarLen = 0x1,.pktLen = 0x1e, // SET APPLICATION PAYLOAD LENGTH.syncWord = 0xD391D391,.pPkt = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
};
我就是想用 IEEE 15.4模式收发,用smartRF studio7生成的配置文件里面:
RF_Mode RF_prop =
{.rfMode = RF_MODE_IEEE_15_4,.cpePatchFxn = &rf_patch_cpe_ieee,.mcePatchFxn = 0,.rfePatchFxn = 0
};
rfc_CMD_IEEE_TX_t RF_cmdIeeeTx =
{.commandNo = 0x2C01,.status = 0x0000,.pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx.startTime = 0x00000000,.startTrigger.triggerType = 0x0,.startTrigger.bEnaCmd = 0x0,.startTrigger.triggerNo = 0x0,.startTrigger.pastTrig = 0x0,.condition.rule = 0x1,.condition.nSkip = 0x0,.txOpt.bIncludePhyHdr = 0x0,.txOpt.bIncludeCrc = 0x0,.txOpt.payloadLenMsb = 0x0,.payloadLen = 0x1E,.pPayload = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx.timeStamp = 0x00000000
};这些都是不一样的,我如果简单替换,就会导致tx任务阻塞,主要是TIRTOS我也没用过,cc2650也没用过,自己逐个修改寄存器配置实现cc2650芯片802.15.4收发还有点难,如果cc2650能有类似cc2530提供的 basicRF例程就好了
user1938356:
回复 Viki Shi:
我现在是用smartrf studio进行配置的,但是程序执行到
RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdIeeeTx, RF_PriorityNormal, NULL, 0);
就一直不返回了,这是什么问题呢?
user1938356:
回复 Viki Shi:
我现在是用smartrf studio进行配置的,但是程序执行到
RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdIeeeTx, RF_PriorityNormal, NULL, 0);
就一直不返回了,这是什么问题呢?
Viki Shi:
回复 user1938356:
请参考这边的类似问题:e2e.ti.com/…/759460