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.

需求是平时一直处于RF_cmdPropRx命令,但接到串口命令时需要发一个RF_cmdPropTxAdv进行唤醒。但不知道rx 超时该如何设置,做了如下操作仍是不行?

需求是平时一直处于RF_cmdPropRx命令,但接到串口命令时需要发一个RF_cmdPropTxAdv进行唤醒。

计划是让在while1中RF_cmdPropRx 500ms超时然后执行下一步判断,是否需要进行RF_cmdPropTxAdv发送。

在每次执行RF_runCmd RF_cmdPropRx前做了如下设置,但调试发现仍旧卡在RF_runCmd ,没有进行下一步:

RF_cmdPropRx.endTrigger.triggerType = TRIG_ABSTIME;

RF_cmdPropRx.endTime = RF_getCurrentTime() + RX_TIMEOUT;

rx 超时该如何设置?

  • 建议查看一下status code看指令是否完成,相关的code可在<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

    如下所示进行检查:

    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) {
        // ...
    }