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.

LAUNCHXL-CC1310: CC1310 - Change Rx Frequency from Button Press

Part Number: LAUNCHXL-CC1310
Other Parts Discussed in Thread: CC1310

I am starting with the rfPacketRx example, and would like to change the RX frequency based on a button press.  I have created a function called setFrequency() that is called when the button is pressed.  But the behavior I get is that the Rx frequency does not seem to change from the original setting that was called upon initialization.  What am I doing wrong?

uint32_t RxFrequencies[8] = {916000000, 916250000, 916500000, 916750000, 917000000, 917250000, 917500000, 917750000};

/***** Function definitions *****/
void setFrequency(uint8_t channel)
{
    if(channel > sizeof(RxFrequencies)) channel = 0;

    uint32_t frequ = RxFrequencies[channel];

    RF_cmdFs.frequency = frequ / 1000000;
    RF_cmdFs.fractFreq = (frequ % 1000000) * 0.065536;

    RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    RF_postCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &callback, RF_EventRxEntryDone); // Initialize receive mode and callback
}

  • Hi Abraham,

    I have tested your method, although with CMD_TX and it seems to function, as seen here:



    How is the callback function executed? Did you tie "setFrequency" directly to the callback handler like so?:

    GPIO_setCallback(Board_GPIO_BUTTON0, gpioButtonFxn0);


    Or is there an intermediary callback function that calls setFrequency, with the correct channel argument? I am asking because RF_postCmd can only be called from Task or SWI context.

    It could also be worth checking the status of RF_cmdFs and RF_cmdPropRx by checking their respective status field (section 23.3.2.6.1 of the CC1310 technical reference manual).

    Regards,

    Arthur