Part Number:CC1310
如标题,我目前使用WOR模式通信,在168K空速,WOR周期为4000ms时间的情况下会出现丢包的情况,而当我将WOR周期时间调小到2000ms或者500ms时,接收效果明显提升,目前对于RF_cmdPropRxSniff的配置如下所示,请问我应该怎么调整我的哪些参数,使其在4000ms时间下能减少丢包。
#define WOR_WAKE_UP_MARGIN_MS 5
#define CMD_PROP_RX_SNIFF 0x3808
RF_cmdPropRxSniff.startTime += (RFEnv.wor.recv_period_ms – WOR_WAKE_UP_MARGIN_MS) * 4000UL;
RF_cmdPropRxSniff.commandNo = CMD_PROP_RX_SNIFF; // Change to RX_SNIFF command from RX command
/* enalbe RSSI and PQT */
RF_cmdPropRxSniff.csConf.bEnaRssi = 0; /* Enable RSSI */
RF_cmdPropRxSniff.csConf.bEnaCorr = 1; /* Enable PQT */
/* General Carrier Sense configuration */
RF_cmdPropRxSniff.csConf.operation = 0; /* Busy if both RSSI and correlation indicates Busy */
RF_cmdPropRxSniff.csConf.busyOp = 0; /* Continue carrier sense on channel Busy */
RF_cmdPropRxSniff.csConf.idleOp = 1; /* End on channel Idle */
RF_cmdPropRxSniff.csConf.timeoutRes = 1; /* If the channel is invalid, it will return PROP_DONE_IDLE_TIMEOUT */
/* RSSI configuration */
RF_cmdPropRxSniff.numRssiIdle = 1; /* One idle RSSI samples signals that the channel is idle */
RF_cmdPropRxSniff.numRssiBusy = 1; /* One busy RSSI samples signals that the channel is busy */
RF_cmdPropRxSniff.rssiThr = (int8_t)WOR_RSSI_THRESHOLD; /* Set the RSSI threshold in dBm */
/* PQT configuration */
RF_cmdPropRxSniff.corrConfig.numCorrInv = 1; /* One busy PQT samples signals that the channel is busy */
RF_cmdPropRxSniff.corrConfig.numCorrBusy = 1; /* One busy PQT samples signals that the channel is busy */
/* Calculate basic timing parameters */
INT32U symbolLengthUs = 1000000UL / radio_rate; // radio period unit microsecond.
INT32U preambleSymbols = (wakeup_period_ms * 1000UL) / symbolLengthUs; // the number of preamble symbols.
INT8U syncWordSymbols = RF_cmdPropRadioDivSetup.formatConf.nSwBits; // the number of sync words.
/* Calculate sniff mode parameters */
#define US_TO_RAT_TICKS 4
#define CORR_PERIOD_SYM_MARGIN 8//16
#define RX_END_TIME_SYM_MARGIN 8
#define CS_END_TIME_MIN_TIME_SYM 30
#define CS_END_TIME_MIN_TIME_STATIC_US 150
/* Represents the time in which we need to receive corrConfig.numCorr* correlation peaks to detect preamble.
* When continously checking the preamble quality, this period has to be wide enough to also contain the sync
* word, with a margin. If it is not, then there is a chance the SNIFF command will abort while receiving the
* sync word, as it no longer detects a preamble. */
INT32U correlationPeriodUs = (syncWordSymbols + CORR_PERIOD_SYM_MARGIN)*symbolLengthUs;
/* Represents the time where we will force a check if preamble is present (only done once).
* The main idea is that his should be shorter than "correlationPeriodUs" so that if we get RSSI valid, but
* there is not a valid preamble on the air, we will leave RX as quickly as possible. */
INT32U csEndTimeUs = (CS_END_TIME_MIN_TIME_SYM*symbolLengthUs + CS_END_TIME_MIN_TIME_STATIC_US);
/* Represents the maximum time from the startTrigger to when we expect a sync word to be received. */
INT32U rxEndTimeUs = (preambleSymbols + syncWordSymbols + RX_END_TIME_SYM_MARGIN)*symbolLengthUs;
/* Set sniff mode timing configuration in sniff command in RAT ticks */
RF_cmdPropRxSniff.corrPeriod = (uint16_t)(correlationPeriodUs * US_TO_RAT_TICKS);
RF_cmdPropRxSniff.csEndTime = (INT32U)(csEndTimeUs * US_TO_RAT_TICKS);
RF_cmdPropRxSniff.endTime = (INT32U)(rxEndTimeUs * US_TO_RAT_TICKS);
/* Set correct trigger types */
RF_cmdPropRxSniff.csEndTrigger.triggerType = TRIG_REL_START; // carrier sense time from command started to csEndTimeUs.
RF_cmdPropRxSniff.endTrigger.triggerType = TRIG_REL_START; // maximum time from command startd to rxEndTimeUs.
RF_cmdPropRxSniff.startTrigger.triggerType = TRIG_ABSTIME; // sinff trigger use absolute time refer to radio RAT.
RF_cmdPropRxSniff.startTrigger.pastTrig = 1;
Links:
您好,
已经收到了您的案例,调查需要些时间,感谢您的耐心等待。
TRANSLATE with x
English
Arabic
Hebrew
PolishBulgarian
Hindi
PortugueseCatalan
Hmong Daw
RomanianChinese Simplified
Hungarian
RussianChinese Traditional
Indonesian
SlovakCzech
Italian
SlovenianDanish
Japanese
SpanishDutch
Klingon
SwedishEnglish
Korean
ThaiEstonian
Latvian
TurkishFinnish
Lithuanian
UkrainianFrench
Malay
UrduGerman
Maltese
VietnameseGreek
Norwegian
WelshHaitian Creole
PersianTRANSLATE with
COPY THE URL BELOW
BackEMBED THE SNIPPET BELOW IN YOUR SITE
Enable collaborative features and customize widget: Bing Webmaster Portal
Back
,
Alice:
您好,
如果您想每 4000 毫秒唤醒一次,这意味着您的发射器需要传输一个 4000 毫秒长的前导码。它能做到这一点吗? tramsitter 的前导码长度是确定 RX 端的 sniff 间隔的唯一因素。 如果您查看 SDK 中的 WOR 示例,您将看到在 TX 端,前导码长度设置为 500 毫秒:
#define WOR_WAKEUPS_PER_SECOND 2/* WOR Example configuration defines */ #define WOR_PREAMBLE_TIME_RAT_TICKS(x) \((uint32_t)(4000000*(1.0f/(x))))RF_cmdPropTxAdv.preTime = WOR_PREAMBLE_TIME_RAT_TICKS(WOR_WAKEUPS_PER_SECOND);RX 端的sniff interval配置为相同的:
#define WOR_WAKEUPS_PER_SECOND2#define WOR_WAKE_UP_INTERVAL_RAT_TICKS(x) \((uint32_t)(4000000*(1.0f/(x) - (WOR_WAKE_UP_MARGIN_S))))RF_cmdPropRxSniff.startTime += WOR_WAKE_UP_INTERVAL_RAT_TICKS(WOR_WAKEUPS_PER_SECOND);如果不更改 TX 端,则无法更改 RX 端。
,
?? ?:
TX端那边,我修改了preTime,这里wakeup_period_ms是4000。
RF_cmdPropTxAdv.preTrigger.triggerType = TRIG_REL_START; RF_cmdPropTxAdv.preTime = wakeup_period_ms * 4000UL;
,
?? ?:
我这边想知道的就是,可能因为晶振或者PA这些外部原因,导致模块在时间上可能会有一些变化,比如我设置的1000ms,实际使用中是1001ms或是999ms。在我发的这些配置参数里面,对于这些比较小的改动,我应该调整哪些参数来进行匹配我当前的硬件
,
Alice:
您好,
请参考下面的示例,它使用 168 kbps 的嗅探模式,传输 4 秒长的前导码。附加了设置、RX 和 TX 代码。您应该使用 SDK 中的 WoR 示例作为起点,然后替换与您共享的 3 个文件。不同时间的计算在我所附的单词 doument 中进行了解释。希望这有帮助。
//********************************************************************************* // Generated by SmartRF Studio version 2.31.0 (build#400) // The applied template is compatible with CC13x0 SDK version 2.10.xx.xx or newer. // Device: CC1310 Rev. B (2.1). // //*********************************************************************************//********************************************************************************* // Parameter summary // RX Address0: 0xAA // RX Address1: 0xBB // RX Address Mode: No address check // Frequency: 868.00000 MHz // Data Format: Serial mode disable// Deviation: 70.000 kHz // Packet Length Config: Variable// Max Packet Length: 255// Packet Length: 20 // Packet Data: 255// RX Filter BW: 311.0 kHz // Symbol Rate: 167.99927 kBaud // Sync Word Length: 32 Bits// TX Power: 14 dBm (requires define CCFG_FORCE_VDDR_HH = 1 in ccfg.c, see CC13xx/CC26xx Technical Reference Manual) // Whitening: No whitening#include "smartrf_settings.h"#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_genfsk.h) #include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_genfsk.h) #include DeviceFamily_constructPath(inc/hw_rfc_dbell.h)// TI-RTOS RF Mode Object RF_Mode RF_prop = {.rfMode = RF_MODE_PROPRIETARY_SUB_1,.cpePatchFxn = &rf_patch_cpe_genfsk,.mcePatchFxn = 0,.rfePatchFxn = &rf_patch_rfe_genfsk };// Overrides for CMD_PROP_RADIO_DIV_SETUP uint32_t pOverrides[] = {// override_use_patch_prop_genfsk.xml// PHY: Use MCE ROM bank 4, RFE RAM patchMCE_RFE_OVERRIDE(0,4,0,1,0,0),// override_synth_prop_863_930_div5.xml// Synth: Set recommended RTRIM to 7HW_REG_OVERRIDE(0x4038,0x0037),// Synth: Set Fref to 4 MHz(uint32_t)0x000684A3,// Synth: Configure fine calibration settingHW_REG_OVERRIDE(0x4020,0x7F00),// Synth: Configure fine calibration settingHW_REG_OVERRIDE(0x4064,0x0040),// Synth: Configure fine calibration setting(uint32_t)0xB1070503,// Synth: Configure fine calibration setting(uint32_t)0x05330523,// Synth: Set loop bandwidth after lock to 20 kHz(uint32_t)0x0A480583,// Synth: Set loop bandwidth after lock to 20 kHz(uint32_t)0x7AB80603,// Synth: Configure VCO LDO (in ADI1, set VCOLDOCFG=0x9F to use voltage input reference)ADI_REG_OVERRIDE(1,4,0x9F),// Synth: Configure synth LDO (in ADI1, set SLDOCTL0.COMP_CAP=1)ADI_HALFREG_OVERRIDE(1,7,0x4,0x4),// Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering(uint32_t)0x02010403,// Synth: Configure extra PLL filtering(uint32_t)0x00108463,// Synth: Increase synth programming timeout (0x04B0 RAT ticks = 300 us)(uint32_t)0x04B00243,// override_synth_disable_bias_div5.xml// Synth: Set divider bias to disabledHW32_ARRAY_OVERRIDE(0x405C,1),// Synth: Set divider bias to disabled (specific for loDivider=5)(uint32_t)0x18000200,// override_phy_rx_aaf_bw_0x0.xml// Rx: Set anti-aliasing filter bandwidth to 0x0 (in ADI0, set IFAMPCTL3[7:4]=0x0)ADI_HALFREG_OVERRIDE(0,61,0xF,0x0),// override_phy_gfsk_rx.xml// Rx: Set LNA bias current trim offset to 3(uint32_t)0x00038883,// Rx: Freeze RSSI on sync found eventHW_REG_OVERRIDE(0x6084,0x35F1),// override_phy_gfsk_pa_ramp_5us_agc_reflevel_0x1c.xml// Tx: Configure PA ramping setting (0x10) for approximately 5 us PA ramp time. Rx: Set AGC reference level to 0x1C.HW_REG_OVERRIDE(0x6088,0x101C),// Tx: Configure PA ramping setting (0x08) for approximately 5 us PA ramp timeHW_REG_OVERRIDE(0x608C,0x0813),// override_phy_rx_rssi_offset_5db.xml// Rx: Set RSSI offset to adjust reported RSSI by +5 dB (default: 0), trimmed for external bias and differential configuration(uint32_t)0x00FB88A3,// TX power override// Tx: Set PA trim to max (in ADI0, set PACTL0=0xF8)ADI_REG_OVERRIDE(0,12,0xF8),(uint32_t)0xFFFFFFFF };// CMD_PROP_RADIO_DIV_SETUP // Proprietary Mode Radio Setup Command for All Frequency Bands rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup = {.commandNo = 0x3807,.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,.modulation.modType = 0x1,.modulation.deviation = 0x118,.symbolRate.preScale = 0xF,.symbolRate.rateWord = 0x1AE14,.symbolRate.decimMode = 0x0,.rxBw = 0x29,.preamConf.nPreamBytes = 0x4,.preamConf.preamMode = 0x0,.formatConf.nSwBits = 0x20,.formatConf.bBitReversal = 0x0,.formatConf.bMsbFirst = 0x1,.formatConf.fecMode = 0x0,.formatConf.whitenMode = 0x0,.config.frontEndMode = 0x0,.config.biasMode = 0x1,.config.analogCfgMode = 0x0,.config.bNoFsPowerUp = 0x0,.txPower = 0xA73F,.pRegOverride = pOverrides,.centerFreq = 0x0364,.intFreq = 0x8000,.loDivider = 0x05 };// CMD_FS // Frequency Synthesizer Programming Command rfc_CMD_FS_t RF_cmdFs = {.commandNo = 0x0803,.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,.frequency = 0x0364,.fractFreq = 0x0000,.synthConf.bTxMode = 0x0,.synthConf.refFreq = 0x0,.__dummy0 = 0x00,.__dummy1 = 0x00,.__dummy2 = 0x00,.__dummy3 = 0x0000 };// CMD_PROP_TX // Proprietary Mode Transmit Command 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 = 0x14,.syncWord = 0x930B51DE,.pPkt = 0 // INSERT APPLICABLE POINTER: (uint8_t*)&xxx };// 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 = 0x0,.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 = 0x930B51DE,.maxPktLen = 0xFF,.address0 = 0xAA,.address1 = 0xBB,.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 };/** Copyright (c) 2016-2019, Texas Instruments Incorporated* All rights reserved.** Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions* are met:** *Redistributions of source code must retain the above copyright*notice, this list of conditions and the following disclaimer.** *Redistributions in binary form must reproduce the above copyright*notice, this list of conditions and the following disclaimer in the*documentation and/or other materials provided with the distribution.** *Neither the name of Texas Instruments Incorporated nor the names of*its contributors may be used to endorse or promote products derived*from this software without specific prior written permission.** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*//***** Includes *****/ /* Standard C Libraries */ #include <stdlib.h>/* XDCtools Header files */ #include <xdc/std.h> #include <xdc/runtime/Assert.h>/* BIOS Header files */ #include <ti/sysbios/BIOS.h> #include <ti/sysbios/knl/Task.h>/* TI-RTOS Header files */ #include <ti/drivers/rf/RF.h> #include <ti/drivers/PIN.h> #include <ti/drivers/pin/PINCC26XX.h>/* Board Header files */ #include "Board.h"/* Application Header files */ #include "RFQueue.h" #include "smartrf_settings/smartrf_settings.h"#include <ti/devices/DeviceFamily.h> #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)/* TI-RTOS Task configuration */ #define RX_TASK_STACK_SIZE 1024 #define RX_TASK_PRIORITY2/* TX Configuration */ #define DATA_ENTRY_HEADER_SIZE 8/* Constant header size of a Generic Data Entry */ #define MAX_LENGTH31 /* Max length byte the radio will accept */ #define NUM_DATA_ENTRIES2/* NOTE: Only two data entries supported at the moment */ #define NUM_APPENDED_BYTES1/* Length byte included in the stored packet */#define CS_END_TIME923 #define CORR_PERIOD1167 #define END_TIME16002583#define SNIFF_INTERVAL (uint32_t)(4000000*(3.9998095f));/***** Variable declarations *****/ /* TX task objects and task stack */ static Task_Params rxTaskParams; static Task_Struct rxTask; static uint8_t rxTaskStack[RX_TASK_STACK_SIZE];/* RF driver object and handle */ static RF_Object rfObject; static RF_Handle rfHandle;/* Pin driver object and handle */ static PIN_Handle ledPinHandle; static PIN_State ledPinState;static PIN_Config pinTable[] = {Board_PIN_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,Board_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,PIN_TERMINATE };/* Buffer which contains all Data Entries for receiving data.* Pragmas are needed to make sure this buffer is 4 byte aligned (requirement from the RF Core) */ #if defined(__TI_COMPILER_VERSION__)#pragma DATA_ALIGN (rxDataEntryBuffer, 4);static uint8_t rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,MAX_LENGTH,NUM_APPENDED_BYTES)]; #elif defined(__IAR_SYSTEMS_ICC__)#pragma data_alignment = 4static uint8_t rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,MAX_LENGTH,NUM_APPENDED_BYTES)]; #elif defined(__GNUC__)static uint8_t rxDataEntryBuffer [RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,MAX_LENGTH, NUM_APPENDED_BYTES)] __attribute__ ((aligned (4))); #else#error This compiler is not supported. #endif/* RX Data Queue and Data Entry pointer to read out received packets */ static dataQueue_t dataQueue; static rfc_dataEntryGeneral_t* currentDataEntry;/* Received packet's length and pointer to the payload */ static uint8_t packetLength; static uint8_t* packetDataPointer;static volatile uint8_t dummy;rfc_propRxOutput_t rxStatistics;/* Sniff command for doing combined Carrier Sense and RX*/ static rfc_CMD_PROP_RX_SNIFF_t RF_cmdPropRxSniff;/***** Prototypes *****/ static void rxTaskFunction(UArg arg0, UArg arg1); static void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);/***** Function definitions *****/ /* RX task initialization function. Runs once from main() */ void rxTaskInit() {Task_Params_init(&rxTaskParams);rxTaskParams.stackSize = RX_TASK_STACK_SIZE;rxTaskParams.priority = RX_TASK_PRIORITY;rxTaskParams.stack = &rxTaskStack;Task_construct(&rxTask, rxTaskFunction, &rxTaskParams, NULL); }/* RX task function. Executed in Task context by TI-RTOS when the scheduler starts. */ static void rxTaskFunction(UArg arg0, UArg arg1) {RF_Params rfParams;RF_Params_init(&rfParams);/* Create queue and data entries */if (RFQueue_defineQueue(&dataQueue,rxDataEntryBuffer,sizeof(rxDataEntryBuffer),NUM_DATA_ENTRIES,MAX_LENGTH + NUM_APPENDED_BYTES)){/* Failed to allocate space for all data entries */while(1);}// Copy RX configuration from RX commandmemcpy(&RF_cmdPropRxSniff, &RF_cmdPropRx, sizeof(rfc_CMD_PROP_RX_t));// Change to RX_SNIFF command from RX commandRF_cmdPropRxSniff.commandNo= CMD_PROP_RX_SNIFF;RF_cmdPropRxSniff.startTrigger.triggerType= TRIG_ABSTIME;RF_cmdPropRxSniff.startTrigger.pastTrig= 0;RF_cmdPropRxSniff.rxConf.bAutoFlushIgnored= 1; // Discard ignored packets from Rx queueRF_cmdPropRxSniff.rxConf.bAutoFlushCrcErr= 1; // Discard packets with CRC error from Rx queueRF_cmdPropRxSniff.maxPktLen= MAX_LENGTH; // Implement packet length filtering to avoid PROP_ERROR_RXBUFRF_cmdPropRxSniff.endTrigger.triggerType= TRIG_REL_START;RF_cmdPropRxSniff.endTime= END_TIME;RF_cmdPropRxSniff.pQueue= &dataQueue; // Set the Data Entity queue for received dataRF_cmdPropRxSniff.pOutput= (uint8_t*)&rxStatistics;RF_cmdPropRxSniff.csConf.bEnaRssi= 0; // Use RSSI to monitor the channelRF_cmdPropRxSniff.csConf.bEnaCorr= 1; // Use the correlator as well as RSSI, to prevent too many false BUSY channelsRF_cmdPropRxSniff.csConf.operation= 1; // Only declare the channel BUSY if both the RSSI and CS criterion are metRF_cmdPropRxSniff.csConf.busyOp= 0; // Continuously monitor the channel so that we can exit as soon as the channel state is IDLERF_cmdPropRxSniff.csConf.idleOp= 1; // Exit RX as soon as an IDLE channel is detectedRF_cmdPropRxSniff.csConf.timeoutRes= 1;RF_cmdPropRxSniff.rssiThr= (-90); // Used for demo purposesRF_cmdPropRxSniff.numRssiIdle= 1;RF_cmdPropRxSniff.numRssiBusy= 1;RF_cmdPropRxSniff.corrPeriod= CORR_PERIOD;RF_cmdPropRxSniff.corrConfig.numCorrInv= 1;RF_cmdPropRxSniff.corrConfig.numCorrBusy= 1;RF_cmdPropRxSniff.csEndTrigger.triggerType= TRIG_REL_START;RF_cmdPropRxSniff.csEndTime= CS_END_TIME;rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);/* Set frequency */RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, &callback, 0);/* Save the current radio time */RF_cmdPropRxSniff.startTime = RF_getCurrentTime();/* Enter main loop */while(1){RF_cmdPropRxSniff.startTime += SNIFF_INTERVAL;/* Schedule RX */RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRxSniff, RF_PriorityNormal, &callback, RF_EventRxEntryDone);} }/* Called for every received packet and command done */ void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e) {/* If we've received a new packet and it's available to read out */if (e & RF_EventRxEntryDone){do{/* Toggle LED on RX */PIN_setOutputValue(ledPinHandle, Board_PIN_LED0, !PIN_getOutputValue(Board_PIN_LED0));/* Get current unhandled data entry */currentDataEntry = RFQueue_getDataEntry();/* Handle the packet data, located at ¤tDataEntry->data:* - Length is the first byte with the current configuration* - Data starts from the second byte */packetLength= *(uint8_t*)(¤tDataEntry->data);packetDataPointer = (uint8_t*)(¤tDataEntry->data + 1);/* This code block is added to avoid a compiler warning.* Normally, an application will reference these variables for* useful data. */dummy = packetLength + packetDataPointer[0];} while(RFQueue_nextEntry() == DATA_ENTRY_FINISHED);} }/**======== main ========*/ int main(void) {/* Call driver init functions. */Board_initGeneral();/* Open LED pins */ledPinHandle = PIN_open(&ledPinState, pinTable);Assert_isTrue(ledPinHandle != NULL, NULL);/* Initialize task */rxTaskInit();/* Start BIOS */BIOS_start();return (0); }cmdPropRxSniff.docx
这个代码,测试了传输 100 个数据包,没有丢失任何一个数据包。
,
?? ?:
这个docx进不去,提示You do not have permission to view this directory or page.
,
Alice:
您好,
请直接测试代码。
TI中文支持网

