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.

CC1310: How can i determine if a Tx has completed successfully or timed-out?

Part Number: CC1310

I am experimenting with two CC1310EM-7XD modules on SMARTRF06EB EVM kits. My starting point was the example project:
C:\ti\tirtos_cc13xx_cc26xx_2_21_00_06\examples\IAR\CC1310DK_7XD\rfPacketErrorRate
I have essentially merged Tx.c and Rx.c and the two boards running similar code are able to talk to each other. I want one board to Tx a packet then immediately Rx a packet with a timeout. I have added to RF_cmdPropRx to include a timeout and have Tx and Rx inside a loop:

RF_cmdPropRx.pQueue = &dataQueue;
RF_cmdPropRx.pOutput = (uint8_t*)&rxStatistics_prop;
RF_cmdPropRx.maxPktLen = MAX_LENGTH;
RF_cmdPropRx.pktConf.bRepeatOk = 0;    // changed
RF_cmdPropRx.pktConf.bRepeatNok = 0;    // changed
RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1;
RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1;
// additionally:
RF_cmdPropRx.rxConf.endTrigger.triggerType = TRIG_REL_START;
RF_cmdPropRx.rxConf.endTrigger.pastTrig = 1;
RF_cmdPropRx.rxConf.endTime = (uint32_t)(4000000*0.040f); // 40ms timeout
.
.
.
while(1) {
    time += packetInterval;
	RF_cmdPropTx.startTime = time;
    result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);    // Tx
    result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &rx_callback, RF_EventRxEntryDone);    // Rx
	... 'here'

The rx_callback() function is still in place but I believe it is not called by an RF_runCmd().
My question is, how can I determine 'here' if the Rx completed successfully or timed out (without looking at the data) please?

  • Hi,

    every radio operation command has a status code which tells you how the command finished. Codes for proprietary commands are provided in <driverlib/rf_prop_mailbox.h>:

    #define PROP_DONE_OK            0x3400  ///< Operation ended normally
    #define PROP_DONE_RXTIMEOUT     0x3401  ///< Operation stopped after end trigger while waiting for sync
    #define PROP_DONE_BREAK         0x3402  ///< Rx stopped due to timeout in the middle of a packet
    #define PROP_DONE_ENDED         0x3403  ///< Operation stopped after end trigger during reception
    #define PROP_DONE_STOPPED       0x3404  ///< Operation stopped after stop command
    #define PROP_DONE_ABORT         0x3405  ///< Operation aborted by abort command
    #define PROP_DONE_RXERR         0x3406  ///< Operation ended after receiving packet with CRC error
    #define PROP_DONE_IDLE          0x3407  ///< Carrier sense operation ended because of idle channel
    #define PROP_DONE_BUSY          0x3408  ///< Carrier sense operation ended because of busy channel
    #define PROP_DONE_IDLETIMEOUT   0x3409  ///< Carrier sense operation ended because of timeout with csConf.timeoutRes = 1
    #define PROP_DONE_BUSYTIMEOUT   0x340A  ///< Carrier sense operation ended because of timeout with csConf.timeoutRes = 0
    
    ///@}
    /// \name Operation finished with error
    ///@{
    #define PROP_ERROR_PAR          0x3800  ///< Illegal parameter
    #define PROP_ERROR_RXBUF        0x3801  ///< No available Rx buffer at the start of a packet
    #define PROP_ERROR_RXFULL       0x3802  ///< Out of Rx buffer during reception in a partial read buffer
    #define PROP_ERROR_NO_SETUP     0x3803  ///< Radio was not set up in proprietary mode
    #define PROP_ERROR_NO_FS        0x3804  ///< Synth was not programmed when running Rx or Tx
    #define PROP_ERROR_RXOVF        0x3805  ///< Rx overflow observed during operation
    #define PROP_ERROR_TXUNF        0x3806  ///< Tx underflow observed during operation

    So you can do 2 checks:

    RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &rx_callback, RF_EventRxEntryDone);
    // result tells you whether the command finished normally (RF_EventLastCmdDone) or was aborted due to RF_cancelCmd() or something else. if (!(result & RF_EventLastCmdDone)) { // ... } // the status code tells you more about what happended with the command if (((volatile RF_Op*)&RF_cmdPropRx)->status == PROP_DONE_RXTIMEOUT) { // ... }

    The result is generic for all commands. The status code is command-specific.

  • Thanks for that Richard. Sorry for the slow reply, I've been working on other stuff.

    How would this same status be retrieved from a callback like that in rf.c please?:

    rxCmdHndl = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &rx_callback, RF_EventRxEntryDone);

    and

    void rx_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
        if (e & RF_EventRxEntryDone)
        {
            /* Get current unhandled data entry */
    ...

    because the values I'm getting for e seem to correspond to messages in RF.h:

    #define   RF_EventCmdDone             (1<<0)   ///< Radio operation command finished
    #define   RF_EventLastCmdDone         (1<<1)   ///< Last radio operation command in a chain finished
    #define   RF_EventTxDone              (1<<4)   ///< Packet transmitted
    ...

    Thanks.

  • Hi,

    if you want to read the command status in the callback, you would implement it that way:

    void rx_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
        if (e & RF_EventCmdDone) // could also use RF_EventLastCmdDone if the command is not chained
        {
            /* Command has finished, let's read the status */
            uint32_t status = RF_cmdPropRx.status;
            if (status == PROP_DONE_RXTIMEOUT) {

  • Thanks Richard, that gives me the status I'm looking for. I have other issues with my timeout but that's a bit off topic so I'll start a new post.
    Best Regards,
    David.