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.

[参考译文] CC1311P3:如何设置射频回调函数

Guru**** 2386620 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1104727/cc1311p3-how-to-setup-rf-callback-function

器件型号:CC1311P3

您好!

我对射频回调函数有疑问。 我在 rfPacketTx 中添加了回调函数

        RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, txCallback, 0);

哪种情况是正确的?

执行 rf_runCmd --> txCallback -->传输数据包--> 传输数据包完成

执行 rf_runCmd -->传输数据包--> 传输数据包完成--> txCallback

3. 执行 RF_runCmd --> txCallback -->传输数据包--> 传输数据包完成--> txCallback

如果我想使用案例- 3、如何配置它?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Kimi、

    如果我正确地理解了在调用 runCmd 命令时需要一个回调事件、那么在传输数据包时又需要另一个回调事件? 您将使用第一个事件的目的是什么?

    谢谢、

    玛丽·H

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好,Kimi

    请参阅 RF_runCmd 的文档:

    /**
     *  @brief  Runs synchronously an RF operation command or a chain of commands and returns
     *          the termination reason.
     *
     *  This function appends an RF operation command or a chain of commands to the RF driver's
     *  command queue and then waits for it to complete.
     *  A command is completed if one of the termination events ::RF_EventLastCmdDone,
     *  ::RF_EventCmdCancelled, ::RF_EventCmdAborted, ::RF_EventCmdStopped occurred.
     *
     *  This function is a combination of RF_postCmd() and RF_pendCmd().
     *  All options and limitations for RF_postCmd() apply here as well.
     *
     *  An application should always ensure that the command completed in the expected way and
     *  with an expected status code.
     *
     *  @note Calling context : Task
     *
     *  @param h         Driver handle previously returned by RF_open()
     *  @param pOp       Pointer to the RF operation command.
     *  @param ePri      Priority of this RF command (used for arbitration in multi-client systems)
     *  @param pCb       Callback function called during command execution and upon completion.
     *                   If RF_runCmd() fails, no callback is made.
     *  @param bmEvent   Bitmask of events that will trigger the callback or that can be pended on.
     *  @return          The relevant termination event.
     *
     *  @sa RF_postCmd(), RF_pendCmd(), RF_cancelCmd(), RF_flushCmd()
     */
    extern RF_EventMask RF_runCmd(RF_Handle h, RF_Op *pOp, RF_Priority ePri, RF_Callback pCb, RF_EventMask bmEvent);

    您需要选择要触发回调的事件。  

    可能的事件包括:

    /**
     *  @name RF Core Events
     *  @anchor RF_Core_Events
     *
     *  Events originating on the RF core and caused during command execution.
     *  They are aliases for the corresponding interrupt flags.
     *  RF Core Events are command-specific and are explained in the Technical Reference Manual.
     *
     *  @sa RF_postCmd(), RF_pendCmd(), RF_runCmd()
     *  @{
     */
    #define   RF_EventCmdDone             (1 << 0)   ///< A radio operation command in a chain finished.
    #define   RF_EventLastCmdDone         (1 << 1)   ///< A stand-alone radio operation command or the last radio operation command in a chain finished.
    #define   RF_EventFGCmdDone           (1 << 2)   ///< A IEEE-mode radio operation command in a chain finished.
    #define   RF_EventLastFGCmdDone       (1 << 3)   ///< A stand-alone IEEE-mode radio operation command or the last command in a chain finished.
    #define   RF_EventTxDone              (1 << 4)   ///< Packet transmitted
    #define   RF_EventTXAck               (1 << 5)   ///< ACK packet transmitted
    #define   RF_EventTxCtrl              (1 << 6)   ///< Control packet transmitted
    #define   RF_EventTxCtrlAck           (1 << 7)   ///< Acknowledgement received on a transmitted control packet
    #define   RF_EventTxCtrlAckAck        (1 << 8)   ///< Acknowledgement received on a transmitted control packet, and acknowledgement transmitted for that packet
    #define   RF_EventTxRetrans           (1 << 9)   ///< Packet retransmitted
    #define   RF_EventTxEntryDone         (1 << 10)  ///< Tx queue data entry state changed to Finished
    #define   RF_EventTxBufferChange      (1 << 11)  ///< A buffer change is complete
    #define   RF_EventPaChanged           (1 << 14)  ///< The PA was reconfigured on the fly.
    #define   RF_EventSamplesEntryDone    (1 << 15)  ///< CTE data has been copied, only valid if autocopy feature is enabled
    #define   RF_EventRxOk                (1 << 16)  ///< Packet received with CRC OK, payload, and not to be ignored
    #define   RF_EventRxNOk               (1 << 17)  ///< Packet received with CRC error
    #define   RF_EventRxIgnored           (1 << 18)  ///< Packet received with CRC OK, but to be ignored
    #define   RF_EventRxEmpty             (1 << 19)  ///< Packet received with CRC OK, not to be ignored, no payload
    #define   RF_EventRxCtrl              (1 << 20)  ///< Control packet received with CRC OK, not to be ignored
    #define   RF_EventRxCtrlAck           (1 << 21)  ///< Control packet received with CRC OK, not to be ignored, then ACK sent
    #define   RF_EventRxBufFull           (1 << 22)  ///< Packet received that did not fit in the Rx queue
    #define   RF_EventRxEntryDone         (1 << 23)  ///< Rx queue data entry changing state to Finished
    #define   RF_EventDataWritten         (1 << 24)  ///< Data written to partial read Rx buffer
    #define   RF_EventNDataWritten        (1 << 25)  ///< Specified number of bytes written to partial read Rx buffer
    #define   RF_EventRxAborted           (1 << 26)  ///< Packet reception stopped before packet was done
    #define   RF_EventRxCollisionDetected (1 << 27)  ///< A collision was indicated during packet reception
    #define   RF_EventModulesUnlocked     (1 << 29)  ///< As part of the boot process, the CM0 has opened access to RF core modules and memories
    #define   RF_EventInternalError       (uint32_t)(1 << 31) ///< Internal error observed
    #define   RF_EventMdmSoft             0x0000002000000000  ///< Synchronization word detected (MDMSOFT interrupt flag)
    /** @}*/
    
    /**
     *  @name RF Driver Events
     *  @anchor RF_Driver_Events
     *
     *  Event flags generated by the RF Driver.
     *  @{
     */
    #define   RF_EventCmdCancelled        0x1000000000000000  ///< Command canceled before it was started.
    #define   RF_EventCmdAborted          0x2000000000000000  ///< Abrupt command termination caused by RF_cancelCmd() or RF_flushCmd().
    #define   RF_EventCmdStopped          0x4000000000000000  ///< Graceful command termination caused by RF_cancelCmd() or RF_flushCmd().
    #define   RF_EventRatCh               0x0800000000000000  ///< A user-programmable RAT channel triggered an event.
    #define   RF_EventPowerUp             0x0400000000000000  ///< RF power up event. \deprecated This event is deprecated. Use #RF_ClientEventPowerUpFinished instead.
    #define   RF_EventError               0x0200000000000000  ///< Event flag used for error callback functions to indicate an error. See RF_Params::pErrCb.
    #define   RF_EventCmdPreempted        0x0100000000000000  ///< Command preempted by another command with higher priority. Applies only to multi-client applications.
    /** @}*/
    

    Siri