需求是平时一直处于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 超时该如何设置?
Viki Shi:
建议查看一下status code看指令是否完成,相关的code可在<driverlib/rf_prop_mailbox.h>找到,摘录如下:
#define PROP_DONE_OK0x3400///< Operation ended normally #define PROP_DONE_RXTIMEOUT0x3401///< Operation stopped after end trigger while waiting for sync #define PROP_DONE_BREAK0x3402///< Rx stopped due to timeout in the middle of a packet #define PROP_DONE_ENDED0x3403///< Operation stopped after end trigger during reception #define PROP_DONE_STOPPED0x3404///< Operation stopped after stop command #define PROP_DONE_ABORT0x3405///< Operation aborted by abort command #define PROP_DONE_RXERR0x3406///< Operation ended after receiving packet with CRC error #define PROP_DONE_IDLE0x3407///< Carrier sense operation ended because of idle channel #define PROP_DONE_BUSY0x3408///< Carrier sense operation ended because of busy channel #define PROP_DONE_IDLETIMEOUT0x3409///< Carrier sense operation ended because of timeout with csConf.timeoutRes = 1 #define PROP_DONE_BUSYTIMEOUT0x340A///< Carrier sense operation ended because of timeout with csConf.timeoutRes = 0///@} /// \name Operation finished with error ///@{ #define PROP_ERROR_PAR0x3800///< Illegal parameter #define PROP_ERROR_RXBUF0x3801///< No available Rx buffer at the start of a packet #define PROP_ERROR_RXFULL0x3802///< Out of Rx buffer during reception in a partial read buffer #define PROP_ERROR_NO_SETUP0x3803///< Radio was not set up in proprietary mode #define PROP_ERROR_NO_FS0x3804///< Synth was not programmed when running Rx or Tx #define PROP_ERROR_RXOVF0x3805///< Rx overflow observed during operation #define PROP_ERROR_TXUNF0x3806///< 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) {// ... }