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/CC1312R: RF RX_Callback is not called as fast as received packets

Part Number: CC1312R

Tool/software: Code Composer Studio

Hi,

we are developing a collector system in which CC1312 is acting as a RF receiver. We are activating RF_Receive function with callback RfRxCallback and posting a semaphore to inform receiverTask about the received packets. When making stress test, we realize that some of the received packets accumulate inside the ReceiveQueue. Then we realize that the RfRxCallback is not called as much the number of received packets. We then change the receiverTask to get all data inside the Queue.

Here is our receive setup and RF initialization codes.

void InitRfPropRxParams(void)
{
    /* Modify CMD_PROP_RX command for application needs */
    RF_cmdPropRx.pQueue = &dataQueue; /* Set the Data Entity queue for received data */
    RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1; /* Discard ignored packets from Rx queue */
    RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1; /* Discard packets with CRC error from Rx queue */
    RF_cmdPropRx.rxConf.bAppendRssi = 1;
    RF_cmdPropRx.rxConf.bAppendTimestamp = 1;
    RF_cmdPropRx.rxConf.bIncludeHdr = 1;
    RF_cmdPropRx.maxPktLen = MAX_LENGTH; /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
    RF_cmdPropRx.pktConf.bVarLen = 1; //Receive length as first byte
    RF_cmdPropRx.pktConf.bRepeatOk = 1; //Continue operation after receiving a packet correctly
    RF_cmdPropRx.pktConf.bRepeatNok = 1; //Go back to sync search after receiving a packet with CRC error
    RF_cmdPropRx.pOutput = (uint8_t *) &rxOutput;
}

static void RfRxCallback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{
    if (e & RF_EventRxEntryDone)
    {
        Semaphore_post(radioRxHandlerSemHandle);
    }
}

static void RadioRxHandler(UArg arg0, UArg arg1)
{
    Semaphore_Params semaphoreParams;
    Semaphore_Params_init(&semaphoreParams);
    rxHandler* dynRxHandler;

    semaphoreParams.instance->name = "radioRxHandlerSemaphore";
    Semaphore_construct(&radioRxHandlerSemStruct, 0, &semaphoreParams);
    radioRxHandlerSemHandle = Semaphore_handle(&radioRxHandlerSemStruct);
    if (radioRxHandlerSemHandle == NULL)
    {
        LOG(LOG_ERR, "radioRxHandlerSemaphore ERR");
    }

    LOG(RF_DEBUG_LEVEL, "RF RX Task is started");
    while (1)
    {
        Semaphore_pend(radioRxHandlerSemHandle, BIOS_WAIT_FOREVER);

        currentDataEntry = RFQueue_getDataEntry();
        while (currentDataEntry->status == DATA_ENTRY_FINISHED)
        {
            device.stats.rfStats.numRfRx++;
            dynRxHandler = malloc(sizeof(rxHandler));
            dynRxHandler->len = (currentDataEntry->data);
            packetDataPointer = (uint8_t *) (&currentDataEntry->data + 1);
            packetRssiPointer = (int8_t *) (packetDataPointer + dynRxHandler->len);
            packetTsPointer = (int8_t *) (packetRssiPointer + 1);
            /* Copy the payload + rssi(1) + timestamp(4) + status(1)  byte to the packet variable */
            memcpy(dynRxHandler->buffer, packetDataPointer, dynRxHandler->len);
            memcpy(&(dynRxHandler->rssi), packetRssiPointer, 1);
            memcpy(&(dynRxHandler->ts), packetTsPointer, 4);
            FcnHandle_RfPacket(dynRxHandler->buffer, dynRxHandler->len, dynRxHandler->rssi, dynRxHandler->ts);
            free(dynRxHandler);
            LOG(RF_DEBUG_LEVEL, "Packet Received len %d, rssi %d", dynRxHandler->len, dynRxHandler->rssi);
            RFQueue_nextEntry();
            currentDataEntry = RFQueue_getDataEntry();
        }
    }
}

Our questions are like this:

1- Is it possible to get as many callbacks as received packets on the air (exact number of packets)?

2- Is this a common usage to get all data from the Queue at once?

Best Regards

  • Not possible to answer your question when I do not know what ISRs you configure for the callback etc.

    Please take a look at the rfPacketRX example. There you will get a callback every time a packet is received and are available in the data entry.

    The handling of the data entry/rfQueue is done in the callback.

    BR

    Siri

  • Hi Siri,

    you are right, I forgot to attach the code whre I activate the RX command. Here is the code:

    void RfControl_GoRx(struct RfControl *ctxt)
    {
        LOG(RF_DEBUG_LEVEL, "Rf Rx Mode Enabled");
        rfCmdHandle = RfPostCommand((RF_Op*) &RF_cmdPropRx, RF_PriorityNormal, &RfRxCallback, (RF_EventRxEntryDone | RF_EventLastCmdDone));
    }
    
    

    I also looked at rfPacketRX and does not see any big difference with my code. As I said before, the number of RXCallback is less than the number of packets inside the queue. Therefore, we need to implement the RXTask to read all the data at once from the queue. I can share my setup and my code in private if you require.

    Best Regards

  • I provide more information related with RX parameters and I think this issue is critical for our application to work properly.

    Best Regards

  • The rfPacketRX example are given you 1 callback per received packet. Use this example as a starting point, and confirm that you see the same

    You can add a counter to the callback that is incremented every time a packet is received, and then you can test by sending a specific number of packets from the TX side.

    When you have confirmed that it works, you can change the code step by step to the way your application works. This way you will know what causes problems, and it will also be easier for us to help you debugging if the problems you are seeing an be reproduced on one of our examples.

    Siri

  • This post is closed due to lack of feedback