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: Wake On Radio with address filter gets woke up regardless of address match

Part Number: CC1310

Tool/software: Code Composer Studio

Hello, I've modified the sample code for rfWakeOnRadioRx in sdk 2 30 00 20, to accommodate a 8 bytes address filter.

rxTaskFunction:

static void rxTaskFunction(UArg arg0, UArg arg1)
{
    RF_Params rfParams;
    RF_Params_init(&rfParams);

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

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

    /* Set frequency */
    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, &callback, 0);

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

        /* Schedule RX */
        RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRxSniff, RF_PriorityNormal, &callback, RF_EventRxEntryDone);

        /* Log RX_SNIFF status */
        switch(RF_cmdPropRxSniff.status) {
            case PROP_DONE_IDLE:
                /* Idle based on RSSI */
                worStatistics.doneIdle++;
                break;
            case PROP_DONE_IDLETIMEOUT:
                /* Idle based on PQT */
                worStatistics.doneIdleTimeout++;
                break;
            case PROP_DONE_RXTIMEOUT:
                /* Got valid preamble on the air, but did not find sync word */
                worStatistics.doneRxTimeout++;
                break;
            case PROP_DONE_OK:
                /* Received packet */
                worStatistics.doneOk++;
                break;
            default:
                /* Unhandled status */
                break;
        };
    }
}

I set the relevant address values as follows:

static uint8_t addTable[8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
...
rxSniffCmd->pAddr = addTable;
rxSniffCmd->addrConf.addrType = 0;
rxSniffCmd->addrConf.addrSize = 8;
rxSniffCmd->addrConf.numAddr = 1;
rxSniffCmd->pktConf.filterOp = 1;

Callback function:

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)
    {
        do
        {
            /* Toggle LED on RX */
            //PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, !PIN_getOutputValue(Board_PIN_LED1));

            /* 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 */
            packetLength      = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->data);
            
            /* This code block is added to avoid a compiler warning.
            * Normally, an application will reference these variables for
            * useful data. */
            dummy = packetLength + packetDataPointer[0];
            int i;
            for(i = 0; i < packetLength; i++){
                printf("%02X ", packetDataPointer[i]);
            }
            printf("\n");

        } while(RFQueue_nextEntry() == DATA_ENTRY_FINISHED);
    }
}

In the callback function, the packet received get printed out if the addresses match.

However, when i probe the device with a multimeter, this is the result:

The first ~7.5mA spike was when a packet with matching address received. The second ~7.5mA spike was a packet with another address.

Is this a normal behavior?

I am expecting the device to just ignore whatever packets not meant for them.

  • To see if a packet has the correct address or not the radio has to go go into RX and actually receive the packet. If the address is incorrect, the radio should be set up to flush the ignored packet from the RF queue. 

    Meaning that you will see a peak in current when the chip is in RX in both cases but in the latter case (incorrect address) the CM3 should not be woken up in this case. Have you checked if you go into the RX callback only when the address is correct or in both cases? 

  • The callback gets called everytime a RX happens, but "e & RF_EventRxEntryDone" returns false, so the code in the do while loop doesnt run.

  • I intended to run some code to do testing.

    First I ran the rfPacketRx/ Tx examples and if I add address filtering to this and the receive address is different from the address the tx side, the callback on the rx side is not called.

    When I look at the code you posted, it looks like 

    rxSniffCmd->pAddr = addTable;
    rxSniffCmd->addrConf.addrType = 0;
    rxSniffCmd->addrConf.addrSize = 8;
    rxSniffCmd->addrConf.numAddr = 1;
    is from the ADV sniff command but it looks like you are running RF_cmdPropRxSniff? 
  • Hi there, its the adv version. I didn't change the variable name but i did change the type though

    static rfc_CMD_PROP_RX_ADV_SNIFF_t RF_cmdPropRxSniff;

  • My intention was to do a small test to check the functionality. When testing with the packetRx or the default WOR example with added address filtering I don't enter the callback if the address is different between on the TX and RX side. It could be that the adv command behaves differently. 

  • If that's the case, can i change the behavior of the adv command? or is it possible to increase the size of the address in the non adv command?

  • I intended to dive deeper into this but haven't had the time. 

    I believe the answer is no on both questions.