在RFEasyLinkEchoRX和TX例程中,我把两边的smartrf_setting.c中对应的地址都修改成除了默认之外的地址。之后两个例程就不能够通信了。请问还需要修改哪些地方?
1.smartrf_setting.c文件中
.address0 = 0xBB,
.address1 = 0xFE,
2.EasyLink rx/tx示例中
txPacket.dstAddr[0] = 0xbb;
lin shi chang:
请TI工程师帮我看一下,之前其他的例程都是直接修改smartrf_setting中通信地址。不知道有什么区别?
Yonghua Pan:
这是哪个芯片?
lin shi chang:
回复 Yonghua Pan:
CC1310的相关例程
Yonghua Pan:
回复 lin shi chang:
我没有看到例程里面有结构体txPacket,它只是一个数组。你能否告知你的SDK版本,然后把你的改动都附上来。
lin shi chang:
回复 Yonghua Pan:
是的,它是一个数组。SDK:simplelink_cc13x0_sdk_3_20_00_23
smartrf_setting.c
// CMD_PROP_RX
// Proprietary Mode Receive Command
rfc_CMD_PROP_RX_t RF_cmdPropRx =
{
.commandNo = 0x3802,
.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.bRepeatOk = 0x0,
.pktConf.bRepeatNok = 0x0,
.pktConf.bUseCrc = 0x1,
.pktConf.bVarLen = 0x1,
.pktConf.bChkAddress = 0x1,
.pktConf.endType = 0x0,
.pktConf.filterOp = 0x0,
.rxConf.bAutoFlushIgnored = 0x0,
.rxConf.bAutoFlushCrcErr = 0x0,
.rxConf.bIncludeHdr = 0x1,
.rxConf.bIncludeCrc = 0x0,
.rxConf.bAppendRssi = 0x0,
.rxConf.bAppendTimestamp = 0x0,
.rxConf.bAppendStatus = 0x1,
.syncWord = 0x00000000,
.maxPktLen = 0x80, // MAKE SURE DATA ENTRY IS LARGE ENOUGH
.address0 = 0xAA,
.address1 = 0xFE,
.endTrigger.triggerType = 0x1,
.endTrigger.bEnaCmd = 0x0,
.endTrigger.triggerNo = 0x0,
.endTrigger.pastTrig = 0x0,
.endTime = 0x00000000,
.pQueue = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
.pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
};
rfeasyLinkEchoTx:
static void rfEasyLinkEchoTxFnx(UArg arg0, UArg arg1)
{
uint32_t absTime;
/* Create a semaphore for Async */
Semaphore_Params params;
Error_Block eb;
/* Init params */
Semaphore_Params_init(¶ms);
Error_init(&eb);
/* Create semaphore instance */
echoDoneSem = Semaphore_create(0, ¶ms, &eb);
if(echoDoneSem == NULL)
{
System_abort("Semaphore creation failed");
}
#if DISPLAY_OPEN
Display_Init();
#endif
#if UART_OPEN
Uart_Init();
Data.head.Mache = 0x02;
Data.head.Func = 0xA2;
Data.Addr = 0x0A02;
Data.angle_data.CRC16 = 0x8090;
#endif
// Initialize the EasyLink parameters to their default values
EasyLink_Params easyLink_params;
EasyLink_Params_init(&easyLink_params);
/*
* Initialize EasyLink with the settings found in easylink_config.h
* Modify EASYLINK_PARAM_CONFIG in easylink_config.h to change the default
* PHY
*/
if(EasyLink_init(&easyLink_params) != EasyLink_Status_Success)
{
System_abort("EasyLink_init failed");
}
/*
* If you wish to use a frequency other than the default, use
* the following API:
* EasyLink_setFrequency(868000000);
*/
// Packet Originator
while(1)
{
#if UART_OPEN
UART_read(uart, Uart_RxBuf, RX_LENGTH);
/* Create packet with incrementing sequence number and random payload */
txPacket.payload[0] = Uart_RxBuf[0];
txPacket.payload[1] = Uart_RxBuf[1];
txPacket.payload[2] = Uart_RxBuf[2];
txPacket.payload[3] = Uart_RxBuf[3];
#endif
#if DISPLAY_OPEN
/* Create packet with incrementing sequence number and random payload */
txPacket.payload[0] = 0x02;
txPacket.payload[1] = 0x83;
#endif
uint8_t i;
for (i = 4; i < RFEASYLINKECHO_PAYLOAD_LENGTH; i++)
{
txPacket.payload[i] = i;
}
txPacket.len = RFEASYLINKECHO_PAYLOAD_LENGTH;
/*
* Address filtering is enabled by default on the Rx device with the
* an address of 0xAA. This device must set the dstAddr accordingly.
*/
txPacket.dstAddr[0] = 0xbb;
/* Set Tx absolute time to current time + 1000ms */
if(EasyLink_getAbsTime(&absTime) != EasyLink_Status_Success)
{
// Problem getting absolute time
}
txPacket.absTime = absTime + EasyLink_ms_To_RadioTime(1000);
EasyLink_transmitAsync(&txPacket, echoTxDoneCb);
/* Wait for Tx to complete. A Successful TX will cause the echoTxDoneCb
* to be called and the echoDoneSem to be released, so we must
* consume the echoDoneSem
*/
Semaphore_pend(echoDoneSem, BIOS_WAIT_FOREVER);
/* Switch to Receiver */
EasyLink_receiveAsync(echoRxDoneCb, 0);
/* Wait 500ms for Rx */
if(Semaphore_pend(echoDoneSem, (500000 / Clock_tickPeriod)) == FALSE)
{
/* RX timed out abort */
if(EasyLink_abort() == EasyLink_Status_Success)
{
/* Wait for the abort */
Semaphore_pend(echoDoneSem, BIOS_WAIT_FOREVER);
}
}
#if UART_OPEN
memset(Uart_RxBuf, 0, MAX_NUM_RX_BYTES);
Semaphore_pend(UARTSemaphoreHandle, BIOS_WAIT_FOREVER);
#endif
}
}