
.. _DEBUG_rf_output:

Debugging RF Output
===================

As mentioned in the |TRM|, the RF output can be mapped to pins on the
LaunchPad for RF signal debugging. These pins are intended to be used when
connecting an RF range extender. However, they can also help in instances
where it is unclear if the device is transmitting or receiving in the right
window.

.. ifconfig:: device != 'cc23xx'

    To enable RF output debugging, you will need to map the RF Core LNA enable and
    PA enable output or Tx start signals to a GPIO. See :ref:`debugging-enable-rf-observables`
    for an example of using DIO6 to output the LNA enable signal (logic high
    corresponds to an Rx) and DIO7 to output the Tx start (logic high corresponds
    to a Tx). These pins correspond to the Red (DIO6) and Green (DIO7) |LP| LEDs and
    if the jumpers are connected, these LEDs will flicker to indicate RF activity. By
    connecting a logic analyzer to these pins, the RF activity over time can be recorded.
    If these pins are unavailable in your project, you can select any available DIO.

    .. _debugging-enable-rf-observables:

    .. code-block:: c
        :caption: Enable RF Observables

        /*******************************************************************************
         * INCLUDES
        */
        #include <driverlib/ioc.h>

        // ...

        int main()
        {

            /*
             * Add the following after Board_initGeneral();
             * Be sure IOIDs used below are not used by any entries in PIN or
             * GPIO tables from the board files
             */

            // Map LNA enable pin RFC_GPO0 to DIO6
            IOCPortConfigureSet(IOID_6, IOC_PORT_RFC_GPO0,
                                IOC_IOMODE_NORMAL);
            // Map Tx start pin RFC_GPO3 to DIO7
            IOCPortConfigureSet(IOID_7, IOC_PORT_RFC_GPO3,
                                IOC_IOMODE_NORMAL);

            // ...

        }

    For more details, see the "External Signaling" chapter of the |TRM|.

.. ifconfig:: device == 'cc23xx'

    On the |DEVICE|, the RF observables should be enabled through SysConfig.
    In SysConfig -> ``TI DRIVERS`` -> ``RCL`` -> ``RCL Observables``,

        * For ``Use Case`` select ``PA/LNA Pins``
        * The settings for the ``Additional RF GPIO Signals`` should be automatically selected
          (``RFEGPO0 (PA_EN)`` and ``RFEGPO1 (LNA_EN)``)

    The DIO the signal is outputted on can then be
    configured under SysConfig -> ``TI DRIVERS`` -> ``RCL`` -> ``PinMux``

        * ``LRF GPIO`` should be left to ``LRF``
        * ``RFEGPO0 Pin`` should be set to the DIO wanted for the PA signal (Radio Tx)
        * ``RFEGPO0 Pin`` should be set to the DIO wanted for the LNA signal (Radio Rx)
 
    .. figure:: /debugging/resources/rf-observables-sysconfig.png
        :align: center

        Configuration to set under SysConfig -> ``TI DRIVERS`` -> ``RCL`` to enable RF Observables
