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 *) (¤tDataEntry->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