Hi Team,
A customer wants to combine LBT+ rfpacketTx.
Step 1: He created a task to measure the temperature sensor based on rfpacketTx and it worked well.
Step 2: He added the LBT example as well, the code could run for a while. But then the RX could not receive data.
This issue may be caused by timer. He wants to control the frequency of data sending, so timer and semaphore are used. Before that, LBT example acts normally. After adding timer and semaphore, this issue occurs and code gets stuck at function RF_postCmd(rfHandle, (RF_Op*)&RF_cmdNop, RF_PriorityNormal,NULL, 0). His code is as follows:
#define PACKET_INTERVAL_US 200000 /* Number of times the CS command should run when the channel is BUSY */ #define CS_RETRIES_WHEN_BUSY 10 /* The channel is reported BUSY is the RSSI is above this threshold */ #define RSSI_THRESHOLD_DBM -80 #define IDLE_TIME_US 5000 static uint32_t time1; /***** Function definitions *****/ void *mainThread(void *arg0) { RF_Params rfParams; RF_Params_init(&rfParams); // Watchdog_Init(TIMEOUT_MS); #ifdef POWER_MEASUREMENT #if defined(Board_CC1350_LAUNCHXL) /* Route out PA active pin to Board_DIO30_SWPWR */ PINCC26XX_setMux(ledPinHandle, Board_DIO30_SWPWR, PINCC26XX_MUX_RFC_GPO1); #endif #endif RF_cmdPropTx.pktLen = PAYLOAD_LENGTH; RF_cmdPropTx.pPkt = packet; // RF_cmdPropTx.startTrigger.triggerType = TRIG_NOW; RF_cmdNop.startTrigger.triggerType = TRIG_ABSTIME; RF_cmdNop.startTrigger.pastTrig = 1; /* Set up the next pointers for the command chain 设置命令链表中,指向下个命令的指针*/ RF_cmdNop.pNextOp = (rfc_radioOp_t*)&RF_cmdPropCs; RF_cmdPropCs.pNextOp = (rfc_radioOp_t*)&RF_cmdCountBranch; RF_cmdCountBranch.pNextOp = (rfc_radioOp_t*)&RF_cmdPropTx; RF_cmdCountBranch.pNextOpIfOk = (rfc_radioOp_t*)&RF_cmdPropCs; /* Customize the API commands with application specific defines */ RF_cmdPropCs.rssiThr = RSSI_THRESHOLD_DBM; RF_cmdPropCs.csEndTime = (IDLE_TIME_US + 150) * 4; /* Add some margin */ RF_cmdCountBranch.counter = CS_RETRIES_WHEN_BUSY; /* Request access to the radio */ #if defined(DeviceFamily_CC26X0R2) rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioSetup, &rfParams); #else rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams); #endif// DeviceFamily_CC26X0R2 /* Set the frequency */ RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0); /* Get current time */ time1 = RF_getCurrentTime(); /* Power down the radio */ RF_yield(rfHandle); while(1) { send_pend(); // FEED_WATCHDOG(); /* Set absolute TX time to utilize automatic power management */ time1 += (PACKET_INTERVAL_US * 4); RF_cmdNop.startTime = time1; /* Send packet */ // RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx,RF_PriorityNormal, NULL, 0); RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdNop, RF_PriorityNormal, NULL, 0); Display_printf(uartDisplayHandle, 0, 0, "Send packet success time:%d\n",time1); switch(terminationReason) { case RF_EventLastCmdDone: // A stand-alone radio operation command or the last radio // operation command in a chain finished. break; case RF_EventCmdCancelled: // Command cancelled before it was started; it can be caused // by RF_cancelCmd() or RF_flushCmd(). break; case RF_EventCmdAborted: // Abrupt command termination caused by RF_cancelCmd() or // RF_flushCmd(). break; case RF_EventCmdStopped: // Graceful command termination caused by RF_cancelCmd() or // RF_flushCmd(). break; default: // Uncaught error event while(1); } uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdPropTx)->status; switch(cmdStatus) { case PROP_DONE_OK: // Packet transmitted successfully break; case PROP_DONE_STOPPED: // received CMD_STOP while transmitting packet and finished // transmitting packet break; case PROP_DONE_ABORT: // Received CMD_ABORT while transmitting packet break; case PROP_ERROR_PAR: // Observed illegal parameter break; case PROP_ERROR_NO_SETUP: // Command sent without setting up the radio in a supported // mode using CMD_PROP_RADIO_SETUP or CMD_RADIO_SETUP break; case PROP_ERROR_NO_FS: // Command sent without the synthesizer being programmed break; case PROP_ERROR_TXUNF: // TX underflow observed during operation break; default: // Uncaught error event - these could come from the // pool of states defined in rf_mailbox.h while(1); } RF_cmdNop.status = IDLE; RF_cmdPropCs.status = IDLE; RF_cmdCountBranch.status = IDLE; RF_cmdPropTx.status = IDLE; RF_cmdCountBranch.counter = CS_RETRIES_WHEN_BUSY; /* Power down the radio */ RF_yield(rfHandle); } }
BR,
Viki Shi