This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC1352P:在代码执行期间在中的射频调制之间切换。

Guru**** 2609895 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1123523/cc1352p-switching-between-rf-modulations-in-during-code-execution

器件型号:CC1352P

您好!

我正在从事一个项目、该项目将在 SmartRF Studio 生成的不同射频调制之间切换。  目前、我的项目中有两个不同的射频设置文件、用于我要在其中切换的两种不同调制。  我有一个函数、通过将射频命令的地址分配给我正在使用的每个命令的指针、使用我选择的调制启动射频驱动器。  

这是我用于打开射频驱动器和初始化某些射频命令的代码。

/*********************************************************************
 * @fn      HWG_Init_RF_Open
 *
 * @brief   Initialize and Open RF Driver
 *
 * @param   modulation_t modulate - Index of modulation type
  *
 * @return  RF_Handle - Handle for opened RF driver
 */
RF_Handle HWG_Init_RF_Open(modulation_t modulate)
{
    /* Setup RF commands to the correct modulation */
    RF_cmdCountBranch = modulationTable[modulate].RF_cmdCountBranch;
    RF_cmdFs = modulationTable[modulate].RF_cmdFs;
    RF_cmdNop = modulationTable[modulate].RF_cmdNop;
    RF_cmdPropCs = modulationTable[modulate].RF_cmdPropCs;
    RF_cmdPropRadioDivSetup = modulationTable[modulate].RF_cmdPropRadioDivSetup;
    RF_cmdPropRx = modulationTable[modulate].RF_cmdPropRx;
    RF_cmdPropTx = modulationTable[modulate].RF_cmdPropTx;
    RF_cmdRxTest = modulationTable[modulate].RF_cmdRxTest;
    RF_cmdTxTest = modulationTable[modulate].RF_cmdTxTest;
    RF_prop = modulationTable[modulate].RF_prop;


    /* Setup RF Parameters */
    RF_Params_init(&rfParams);

    /* Request access to the Radio */
    handleRF = RF_open(&rfObject, RF_prop, (RF_RadioSetup*)RF_cmdPropRadioDivSetup, &rfParams);       // Open and setup RF driver

    /* Set Output Power on the Radio */
    RF_Stat rfStatus = RF_setTxPower(handleRF, RF_TxPowerTable_findValue(txPowerTableTxStd, 10));        // Set Output Power to 10 dBm

    if(rfStatus != RF_StatSuccess)      // Check if power change was successful
    {
        while(1);
    }


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

    /* Modify CMD_PROP_RX command 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 = HWG_PKT_MAX_LENGTH;

    /* Append RX timestamp to the payload */
    RF_cmdPropRx->rxConf.bAppendTimestamp = 1;
    /* Save RX Stats to rxStatistics */
    RF_cmdPropRx->pOutput = (uint8_t*)&rxStatistics;

    return handleRF;

}
 

此代码使用我正在使用的两种调制来初始化和打开射频驱动器。  射频通信在首次初始化后按预期工作。

在初始调制设置后、当我尝试切换到另一个调制时、我会遇到问题。  我用 rf_close()关闭射频驱动程序,并尝试用上面的代码和 radio rf_open()重新打开,但无线电再也无法正常通信。  rf_open()返回一个非 NULL 指针,因此看起来工作正常。

这是我用于切换调制的代码。

/*********************************************************************
 * @fn      HWG_Set_Modulation
 *
 * @brief   Function to set the Modulation Type
 *
 * @param   modulation_t modulation - Modulation type to setup radio
 *
 * @return  none
 */
void HWG_Set_Modulation(modulation_t modulation)
{
    /* Save the Modulation for future reference */
    currentModulation = modulation;

    RF_close(handleRF);     // Close the Current RF driver

    Task_sleep(100000);      // Sleep for 1 second
    HWG_Init_RF_Open(modulation);
}

如上所示、我关闭射频驱动程序、然后使用启动时首次使用的代码重新打开。  即使在初始设置后加载相同的调制、对讲机也会停止正常工作。   

是否需要执行其他操作才能使无线电正常切换调制?

请提出任何建议。

谢谢、

Josh

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    我解决了我的问题。  在关闭并重新打开射频驱动器后、我忘记再次设置射频合成。  这解决了我的问题、现在我可以在调制之间进行切换、所有操作都正常。

    Josh