Part Number: CC1310
Tool/software: Code Composer Studio
Thanks for your reply. Really what I needed!
But I had a problem.
I slightly changed the example for receiving in turn at 2 frequencies. Reception takes place with a delay of 1 second.
After some time, the processor hangs on the function call.
/* Schedule RX */ RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRxSniff, RF_PriorityHigh, &callback, RF_EventRxEntryDone);
Maybe you can explain what could be the reason ?
I used the example based on NoRTOS.
I will give only changed parts of my source.
// Input Buffer
uint8_t buf[100];
uint8_t len = 0;
volatile bool dataready = false;
/***** Function definitions *****/
/* RX task function. Executed in Task context by TI-RTOS when the scheduler starts. */
void *mainThread(void *arg0)
{
xUartInit(115200);
DBGF("\r\nWOR RX start\r\n");
RF_Params rfParams;
RF_Params_init(&rfParams);
/* Open LED pins */
ledPinHandle = PIN_open(&ledPinState, pinTable);
if (ledPinHandle == NULL)
{
while(1);
}
/* Route out LNA active pin to LED1 */
PINCC26XX_setMux(ledPinHandle, Board_PIN_LED0, 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);
RF_cmdPropRxSniff.startTime = RF_getCurrentTime();
/* Enter main loop */
while(1)
{
PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 1);
// -------------------------------------
/* Set frequency */
RF_cmdFs.fractFreq = 0x0000; // xxx.0 MHz
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityHigh, 0, 0);
/* Schedule RX */
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRxSniff, RF_PriorityHigh, &callback, RF_EventRxEntryDone);
if(dataready) {
DBGH("870.0",buf,len);
dataready = false;
}
// -------------------------------------
/* Set frequency */
RF_cmdFs.fractFreq = 0x8000; // xxx.5 MHz
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityHigh, 0, 0);
/* Schedule RX */
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRxSniff, RF_PriorityHigh, &callback, RF_EventRxEntryDone);
PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 0);
if(dataready) {
DBGH("870.5",buf,len);
dataready = false;
}
// -------------------------------------
// Sleep
RF_yield(rfHandle); // Power down the radio
sleep(1); // 1s
// exit RF from sleep
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdNop, RF_PriorityHigh, 0, 0);
}
}
/* Called for every received packet and command done */
void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{
/* If we've received a new packet and it's available to read out */
if (e & RF_EventRxEntryDone)
{
/* Get current unhandled data entry */
currentDataEntry = RFQueue_getDataEntry();
/* Handle the packet data, located at ¤tDataEntry->data:
* - Length is the first byte with the current configuration
* - Data starts from the second byte */
len = packetLength = *(uint8_t*)(¤tDataEntry->data);
packetDataPointer = (uint8_t*)(¤tDataEntry->data + 1);
memcpy(buf,packetDataPointer,packetLength);
dataready = true;
/* This code block is added to avoid a compiler warning.
* Normally, an application will reference these variables for
* useful data. */
//dummy = packetLength + packetDataPointer[0];
RFQueue_nextEntry();
}
}