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.

CCS/CC1310: Preamble detection

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 &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            len = packetLength = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->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();
    }
}

  • Based on the code posted it could look like you have a timing issue. 

    In the original WOR example we update the startTime for the command for each iteration. The radio goes automatically in sleep since the startup is a point in the future (500 ms in this case, given by the preamble length) 

    Ref the relevant parts of the code below:

    /* Save the current radio time */
        RF_cmdPropRxSniff.startTime = RF_getCurrentTime();
    
        /* Enter main loop */
        while(1)
        {
            /* Set next wakeup time in the future */
            RF_cmdPropRxSniff.startTime += WOR_WAKE_UP_INTERVAL_RAT_TICKS(WOR_WAKEUPS_PER_SECOND);
    

    In your code you are not updating the startTime and you are using SLEEP in addition. You can do this but then you have to change he trigger to TRIG_NOW.

    Not sure why you are using this line:

    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdNop, RF_PriorityHigh, 0, 0);

  • 1)

    I need the command to start immediately, without waiting for the RAT.

    Correctly, I realized that you need to set this parameter for the immediate start of the command?   rxSniffCmd->startTrigger.triggerType = TRIG_NOW;   ???

    2)

    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdNop, RF_PriorityHigh, 0, 0);    <-   I thought that this command RF_cmdNop brings the RF part out of sleep, or is it not?

  • 1) Yes

    2) No.The CM3 does not run when you are in the lowest power modes so you are not running the NOP command before you are actually out of sleep. 

  • Thanks for your reply.

    I have another question. 
    I took the original rfWakeOnRadioRx example and just added the output of statistics and the received packet to the UART.

    When the packet is received correctly, I have never seen the counter increment "worStatistics.doneOk"

    Although the rxStatistics.nRxOk counter is incremented when the packet is accepted.

    Why it happens ?

  • Tell me, what other commands should the RF core be sent for fast correct switching of the receiving frequency?

    RF_cmdFs.fractFreq = 0x0000;  // xxx.0 MHz
    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityHigh, 0, 0);
    .... RX
    RF_cmdFs.fractFreq = 0x8000;  // xxx.5 MHz
    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityHigh, 0, 0);
    .... RX
    Only one command  RF_cmdFs  ? 
  • Hi Igor,

    You are correct in the assumptions, to perform frequency switching, you would issue the "RF_cmdFs" just as you done above.

    If you have a known sequence, you could chain multiple commands together in order to issue the chain as a "single command" to the radio. This could help with speeding the over all RX -> RX transition as you do not need to go back to the M3 to start the next command.