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

CC1310重新初始化

TI工程师,您好!我在打开无线设备后,想重新初始化一下速率和频率,也就是重新初始化一次无线设备,请问该如何操作呢?谢谢!

RF_Params rfParams;
RF_Params_init(&rfParams);

/* Open LED pins */
ledPinHandle = PIN_open(&ledPinState, pinTable);
if (ledPinHandle == NULL)
{
while(1);
}
//sleep(5);
/* Route out LNA active pin to LED1 */
PINCC26XX_setMux(ledPinHandle, Board_PIN_LED1, PINCC26XX_MUX_RFC_GPO0);

/* 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 all RX options from the SmartRF Studio exported RX command to the RX Sniff command */
initializeSniffCmdFromRxCmd(&RF_cmdPropRxSniff, &RF_cmdPropRx);

/* Configure RX part of RX_SNIFF command */
RF_cmdPropRxSniff.pQueue = &dataQueue;
RF_cmdPropRxSniff.pOutput = (uint8_t*)&rxStatistics;
RF_cmdPropRxSniff.maxPktLen = MAX_LENGTH;

/* Discard ignored packets and CRC errors from Rx queue */
RF_cmdPropRxSniff.rxConf.bAutoFlushIgnored = 1;
RF_cmdPropRxSniff.rxConf.bAutoFlushCrcErr = 1;

/* Calculate datarate from prescaler and rate word */
uint32_t datarate = calculateSymbolRate(RF_cmdPropRadioDivSetup.symbolRate.preScale,
RF_cmdPropRadioDivSetup.symbolRate.rateWord);

/* Configure Sniff-mode part of the RX_SNIFF command */
configureSniffCmd(&RF_cmdPropRxSniff, WOR_MODE, datarate, WOR_WAKEUPS_PER_SECOND);

/* Request access to the radio */
rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);

/* Set frequency */
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, &callback, 0);

while(1)

{

}

其实我的应用是这样的,无线唤醒时,由于数据量小,故而用一个速率比较快的方式,当真正在通信时,需要提高通信的灵敏度和成功率,所以需要一个速率较低的方式进行。我尝试过在wakeOnRadio下修改,每次接受到数据之间RF_close(),再重新初始化,发现根本不能关闭,仿真时,之间死在RF_close里面。所以需要问下,RF_open和RF_close到底是如何操作的?另外,我的速率参数修改是否一定需要close后再重新初始化。

user3895839:

我看过,就是 rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);中的 RF_cmdPropRadioDivSetup参数需要重新设置。

Felix ZF:

你设置的接收到数据后的工作状态是什么?

如果是继续接收,那么你需要先退出RX状态,在RF处于idle时调用RF_close()。

关于RF_close()函数的使用例程,可以参看rfPacketErrorRate示例工程。

另外,修改频率可以直接使用RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);

修改速率,可以使用RF_control(rfHandle, RF_CTRL_UPDATE_SETUP_CMD, NULL) 命令

可以借鉴如下做法:

Use the command RF_control(..,RF_CTRL_UPDATE_SETUP_CMD, ..) after defining the new frequency. RF_CTRL_UPDATE_SETUP_CMD signals that the change will take effect immidiate on the next power cycle.The flow could look like this:RF_openStart RX (using freq. 1)Exit RxRF_control (RF_CTRL_UPDATE_SETUP_CMD) – change to freq.2 Go to standby or atleast power down RF core (either RF_yield or set inactivityTimeout)Start Rx (using freq. 2)Exit RxRF_control (RF_CTRL_UPDATE_SETUP_CMD) – change to freq.1Go to standby or atleast power down RF core (either RF_yield or set inactivityTimeout)Start Rx (using freq. 1)Exit RxDriver documentation:

http://dev.ti.com/tirex/content/simplelink_cc13x0_sdk_1_30_00_06/docs/tidrivers/doxygen/html/_r_f_8h.html

Description of define RF_CTRL_UPDATE_SETUP_CMD :Setting this control notifies RF that the setup command is to be updated, so that RF will take proper actions when executing the next setup command. Note the updated setup command will take effect in the next power up cycle when RF executes the setup command. Prior to updating the setup command, user should make sure all pending commands have completed.

user3895839:

回复 Felix ZF:

您好。我想问下:我的另外一种速率定义为RF_cmdPropRadioDivSetup_100,然后RF_control是在下面的一个命令吗?

rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup_100, &rfParams); RF_control(rfHandle, RF_CTRL_UPDATE_SETUP_CMD, NULL);

按照这个测试还是一样,收到的还是原来速率的数据,并未更新为新的。

user3895839:

回复 Felix ZF:

追加一问,是设置的接收到数据后的工作状态变为IDLE是如何设置?

Felix ZF:

回复 user3895839:

可以借鉴如下做法:

Use the command RF_control(..,RF_CTRL_UPDATE_SETUP_CMD, ..) after defining the new frequency. RF_CTRL_UPDATE_SETUP_CMD signals that the change will take effect immidiate on the next power cycle.The flow could look like this:RF_openStart RX (using freq. 1)Exit RxRF_control (RF_CTRL_UPDATE_SETUP_CMD) – change to freq.2 Go to standby or atleast power down RF core (either RF_yield or set inactivityTimeout)Start Rx (using freq. 2)Exit RxRF_control (RF_CTRL_UPDATE_SETUP_CMD) – change to freq.1Go to standby or atleast power down RF core (either RF_yield or set inactivityTimeout)Start Rx (using freq. 1)Exit RxDriver documentation:

http://dev.ti.com/tirex/content/simplelink_cc13x0_sdk_1_30_00_06/docs/tidrivers/doxygen/html/_r_f_8h.html

Description of define RF_CTRL_UPDATE_SETUP_CMD :Setting this control notifies RF that the setup command is to be updated, so that RF will take proper actions when executing the next setup command. Note the updated setup command will take effect in the next power up cycle when RF executes the setup command. Prior to updating the setup command, user should make sure all pending commands have completed.

user3895839:

回复 Felix ZF:

请问下,答案能否再通俗点呢?

赞(0)
未经允许不得转载:TI中文支持网 » CC1310重新初始化
分享到: 更多 (0)