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.

RTOS/CC1310: Changing Frequency On-the-Fly w?EasyLink API

Part Number: CC1310

Tool/software: TI-RTOS

Hi,

After changing the frequency on-the-fly using the method in the linked thread, I noticed that while Tx works fine, errors are encountered in Rx (specifically EasyLink_Status_Rx_Error).

My guess is that this is because the new frequency does not match the frequency specified in smartrf_settings.c, which was used during EasyLink_init.

May I know if there is a solution for this?

Thank you.

  • You need to show details on what you are doing in your code for us to be able to help you.

    I took the rfEasyLinkEchoTx example and changed the frequency  between every RX and TX as shown below. I did not experience any problems

    static EasyLink_Status statusFreq;
    static EasyLink_Status statusTx;
    static EasyLink_Status statusRx;
    
    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(&params);
        Error_init(&eb);
    
        /* Create semaphore instance */
        echoDoneSem = Semaphore_create(0, &params, &eb);
        if(echoDoneSem == NULL)
        {
            System_abort("Semaphore creation failed");
        }
        
        EasyLink_Params easyLink_params;
        EasyLink_Params_init(&easyLink_params);
    	
    	easyLink_params.ui32ModType = EasyLink_Phy_Custom; 
    
        /* Initialize EasyLink */
        if(EasyLink_init(&easyLink_params) != EasyLink_Status_Success)
        {
            System_abort("EasyLink_init failed");
        }
    
        /* Set output power to RFEASYLINKECHO_RF_POWER dBm */
        EasyLink_setRfPower(RFEASYLINKECHO_RF_POWER);
    
        // Packet Originator
        while(1) {
            /* Create packet with incrementing sequence number and random payload */
            txPacket.payload[0] = (uint8_t)(seqNumber >> 8);
            txPacket.payload[1] = (uint8_t)(seqNumber++);
            uint8_t i;
            for (i = 2; i < RFEASYLINKECHO_PAYLOAD_LENGTH; i++)
            {
                txPacket.payload[i] = rand();
            }
    
            txPacket.len = RFEASYLINKECHO_PAYLOAD_LENGTH;
            txPacket.dstAddr[0] = 0xaa;
    
            /* 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);
    
            statusFreq = EasyLink_setFrequency(868000000);/
    
            statusTx = 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);
    
            statusFreq = EasyLink_setFrequency(900000000);
    
            /* Switch to Receiver */
            statusRx = 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);
                }
            }
        }
    }

    Siri

  • Hi Siri,

    Many thanks for the reply. Do take a look at these two threads: TER's accepted answer in this thread and your accepted answer in this thread.

    It seems that when the frequency is changed, it is necessary to modify the frequency values in smartrf_settings.c, specifically RF_cmdFs.frequency and RF_cmdPropRadioDivSetup.centerFreq.

    From my tests, the values of these two must match the frequency specified in EasyLink_setFrequency for Tx/Rx to work.

    May I know if there's a way to change the values of RF_cmdFs.frequency and RF_cmdPropRadioDivSetup.centerFreq during runtime, or if there's some other solution?

    Thank you.

  • Not sure if the frequency is the problem. I ran my test code, but changed between 868 MHz and 433 MHz. Every time I tried to set the frequency to 433 MHz, the CMD_FS would fail (statu = 0x0809) but the EasyLink_setFrequency still reported everything to be OK (EasyLink_Status_Success). I have posted this as a bug to the EasyLink team. Can you try to see what the status of your commands are when you see EasyLink_Status_Rx_Error?

    However, when you are alternating between 868 MHz and 900 MHz you should update the setup command in-between the two frequencies. What you can try to do is to manually modify the EasyLink_setFrequency function:

    EasyLink_Status EasyLink_setFrequency(uint32_t ui32Frequency)
    {
        EasyLink_Status status = EasyLink_Status_Cmd_Error;
        //uint64_t ui64FractFreq;
    
        if ( (!configured) || suspended)
        {
            return EasyLink_Status_Config_Error;
        }
        //Check and take the busyMutex
        if (Semaphore_pend(busyMutex, 0) == FALSE)
        {
            return EasyLink_Status_Busy_Error;
        }
    
        /* Set the frequency */
        EasyLink_cmdFs.frequency = (uint16_t)(ui32Frequency / 1000000);
        EasyLink_cmdFs.fractFreq = (uint16_t) (((uint64_t)ui32Frequency -
                ((uint64_t)EasyLink_cmdFs.frequency * 1000000)) * 65536 / 1000000);
    
        if(ui32Frequency == xxxxxxxxxxx)
        {
            EasyLink_cmdPropRadioSetup.divSetup.centerFreq = 0xXXXX;
            EasyLink_cmdPropRadioSetup.divSetup.loDivider = 0xXX;
        }
        else // yyyyyyyyyyy
        {
            EasyLink_cmdPropRadioSetup.divSetup.centerFreq = 0xYYYY;
            EasyLink_cmdPropRadioSetup.divSetup.loDivider = 0xYY;
        }
    
        RF_control(rfHandle, RF_CTRL_UPDATE_SETUP_CMD, NULL);
        RF_yield(rfHandle);
    
        /* Run command */
        RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&EasyLink_cmdFs,
                RF_PriorityNormal, 0, EASYLINK_RF_EVENT_MASK);
    
        if (result & RF_EventLastCmdDone)
        {
            status = EasyLink_Status_Success;
        }
    
        Semaphore_post(busyMutex);
    
        return status;
    }

    Siri

  • Hi Siri,

    Thanks a lot for the reply. Would it be possible for you to be more specific on which status for which commands I should look at when I encounter EasyLink_Status_Rx_Error?

    Manually modifying the EasyLink_setFrequency function seems to be a good idea, I'll give it a try. It would be good if this modification can be included in future releases of EasyLink, as this allows the frequency to completely changed with no loose ends.

    Thank you.
  • You should monitor the EasyLink_cmdFs when doing EasyLink_setFrequency, EasyLink_cmdPropTx when doing EasyLink_transmitAsync and EasyLink_cmdPropRxAdv when doing EasyLink_receiveAsync.

    You should monitor the status of the commands after they have run and check if it makes sense.

    Regarding the EasyLink_setFrequency, I will create a Jira ticket for the issues related to that function.

    BR

    Siri

  • Hi Siri,

    The modified code looks good. Thank you very much for the assistance :)