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: Switching between RF modulations in during Code execution.

Part Number: CC1352P

Hello,

I am working on a project that will switch between different RF modulations generated by SmartRF Studio.  Currently, there are two different RF settings files I have in my project for the two different modulations I would like to switch between.  I have a function that starts up the RF driver with my chosen modulation by assigning the addresses of the RF commands to a pointer for each command I am using. 

Here is the Code I use to open RF driver and initialize some RF commands.

/*********************************************************************
 * @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;

}
 

This code initializes and opens the RF driver fine with both modulations I am using.  The RF communications work as expected after the first initialization.

I am running into problems when I try to switch to the other modulation after the initial modulation setup.  I close the RF driver with RF_close() and try to reopen with the code above and the radio RF_open() but the radio doesn't communicate properly any more.  The RF_open() returns a non-NULL pointer so that seems to work ok.

Here is the code I use to switch the modulations.

/*********************************************************************
 * @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);
}

As you can see above I close the RF driver and reopen using the same code that was first used at startup.  The radio stops working correctly even if I load the same modulation after the initial setup.  

Is there something else that needs to be done in order to get the radio to switch modulations properly?

Any suggestions would be appreciated.

Thanks,

Josh