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.

CC1352P: How to implement RF/Antenna switch callback for custom board?

Part Number: CC1352P
Other Parts Discussed in Thread: CC1312R, CC1190

Hi,

We designed a customized board using CC1352P-launchpad-P2 as a reference. Since we only need the 2.4GHz signals, we dropped the 900MHz matching components, and tied one control pin on SKY13317 to GND, then used only two GPIO to switch between low and high power 900MHz signals.

/* Owned by /ti/drivers/RF as  */
extern const uint_least8_t CONFIG_RF_24GHZ_CONST;
#define CONFIG_RF_24GHZ 27

/* Owned by /ti/drivers/RF as  */
extern const uint_least8_t CONFIG_RF_HIGH_PA_CONST;
#define CONFIG_RF_HIGH_PA 28

/* Owned by /ti/drivers/RF as  */
extern const uint_least8_t CONFIG_RF_SUB1GHZ_CONST;
#define CONFIG_RF_SUB1GHZ 30

The GPIO were switched from DIO_28 and DIO_29 in the reference design to DIO_27 and DIO_28 to make layout easier. In such case how should we implement the RF/Antenna switching callback function? Since the name of the RF Antenna PIN names are defined in syscfg, Can we simply copy the code generated by syscfg for reference board?

/*
 * ======== Antenna switching ========
 */
/*
 * ======== rfDriverCallbackAntennaSwitching ========
 * Sets up the antenna switch depending on the current PHY configuration.
 *
 * Truth table:
 *
 * Path       DIO27 DIO28 DIO30
 * ========== ===== ===== =====
 * Off        0     0     0
 * 2.4 GHZ    1     0     0
 * HIGH PA    0     1     0
 * SUB1 GHZ   0     0     1
 */
void rfDriverCallbackAntennaSwitching(RF_Handle client, RF_GlobalEvent events, void *arg)
{

    if (events & RF_GlobalEventRadioSetup) {
        bool    sub1GHz   = false;
        uint8_t loDivider = 0;

        /* Switch off all paths. */
        GPIO_write(CONFIG_RF_24GHZ, 0);
        GPIO_write(CONFIG_RF_HIGH_PA, 0);
        GPIO_write(CONFIG_RF_SUB1GHZ, 0);

        /* Decode the current PA configuration. */
        RF_TxPowerTable_PAType paType = (RF_TxPowerTable_PAType)RF_getTxPower(client).paType;

        /* Decode the generic argument as a setup command. */
        RF_RadioSetup* setupCommand = (RF_RadioSetup*)arg;

        switch (setupCommand->common.commandNo) {
            case (CMD_RADIO_SETUP):
            case (CMD_BLE5_RADIO_SETUP):
                    loDivider = RF_LODIVIDER_MASK & setupCommand->common.loDivider;

                    /* Sub-1GHz front-end. */
                    if (loDivider != 0) {
                        sub1GHz = true;
                    }
                    break;
            case (CMD_PROP_RADIO_DIV_SETUP):
                    loDivider = RF_LODIVIDER_MASK & setupCommand->prop_div.loDivider;

                    /* Sub-1GHz front-end. */
                    if (loDivider != 0) {
                        sub1GHz = true;
                    }
                    break;
            default:break;
        }

        if (sub1GHz) {
            /* Sub-1 GHz */
            if (paType == RF_TxPowerTable_HighPA) {
                /* PA enable --> HIGH PA
                 * LNA enable --> Sub-1 GHz
                 */
                GPIO_setMux(CONFIG_RF_24GHZ, IOC_PORT_GPIO);
                /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
                         de-asserted on CC1352 Rev A. */
                GPIO_setMux(CONFIG_RF_HIGH_PA, IOC_PORT_RFC_GPO3);
                GPIO_setMux(CONFIG_RF_SUB1GHZ, IOC_PORT_RFC_GPO0);
            } else {
                /* RF core active --> Sub-1 GHz */
                GPIO_setMux(CONFIG_RF_24GHZ, IOC_PORT_GPIO);
                GPIO_setMux(CONFIG_RF_HIGH_PA, IOC_PORT_GPIO);
                GPIO_setMux(CONFIG_RF_SUB1GHZ, IOC_PORT_GPIO);
                GPIO_write(CONFIG_RF_SUB1GHZ, 1);
            }
        } else {
            /* 2.4 GHz */
            if (paType == RF_TxPowerTable_HighPA)
            {
                /* PA enable --> HIGH PA
                 * LNA enable --> 2.4 GHz
                 */
                GPIO_setMux(CONFIG_RF_24GHZ, IOC_PORT_RFC_GPO0);
                /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
                         de-asserted on CC1352 Rev A. */
                GPIO_setMux(CONFIG_RF_HIGH_PA, IOC_PORT_RFC_GPO3);
                GPIO_setMux(CONFIG_RF_SUB1GHZ, IOC_PORT_GPIO);
            } else {
                /* RF core active --> 2.4 GHz */
                GPIO_setMux(CONFIG_RF_24GHZ, IOC_PORT_GPIO);
                GPIO_setMux(CONFIG_RF_HIGH_PA, IOC_PORT_GPIO);
                GPIO_setMux(CONFIG_RF_SUB1GHZ, IOC_PORT_GPIO);
                GPIO_write(CONFIG_RF_24GHZ, 1);
            }
        }
    }
    else if (events & RF_GlobalEventRadioPowerDown) {
        /* Switch off all paths. */
        GPIO_write(CONFIG_RF_24GHZ, 0);
        GPIO_write(CONFIG_RF_HIGH_PA, 0);
        GPIO_write(CONFIG_RF_SUB1GHZ, 0);

        /* Reset the IO multiplexer to GPIO functionality */
        GPIO_setMux(CONFIG_RF_24GHZ, IOC_PORT_GPIO);
        GPIO_setMux(CONFIG_RF_HIGH_PA, IOC_PORT_GPIO);
        GPIO_setMux(CONFIG_RF_SUB1GHZ, IOC_PORT_GPIO);
    }
}

Please advise.

Thanks,

ZL

  • Hi Zhiyong,

    Yes I would recommend you to take the antenna switch callback example code snippet from ti_drivers_config.c as a starting point.

    Cheers,

    Marie H

  • Hi Marie,

    Thanks for your reply.

    There is a note in the comment of generated code:

    /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
        de-asserted on CC1352 Rev A. */

    Is this something we need to take care of when we switch to other GPIO pins?

    Best,

    ZL

  • Hi Zhiyong,

    RFC_GPO3 and RFC_GPO1 refer to RF core data signals. You can read more about them in the TRM, section 13.3.2 Mapping AUXIOs to DIO Pins. 

    https://www.ti.com/lit/swcu185

    Cheers,

    Marie H

  • Hi Marie,

    After reading TRM, my understand is that due to some bug in Rev A CC1352P hardware, we set HIGH_PA pin as IOC_PORT_RFC_GPO3 instead of IOC_PORT_RFC_GPO1 as a workaround of the bug.

    Two follow up questions: 1) Does this bug apply to CC1312R? At the least the version that we can buy from open market? 2) Will this bug in hardware be fixed in the future? Even if it is fixed, should we continue to apply the same workaround just to be safe?

    Thanks,

    ZL

  • Hi Zhiyong,

    Can you point me to where you found this bug in the TRM?

    Cheers,

    Marie H

  • Hi Marie,

    In TRM table 13-1, it states that RFC_GFO1 controls PA enable, and RFC_GFO3 controls TX start. But in currently generated code in RF antenna switch, we see this:

    /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
                             de-asserted on CC1352 Rev A. */
    GPIO_setMux(CONFIG_RF_HIGH_PA, IOC_PORT_RFC_GPO3);

    If not for some sort of bug that, as stated in the comment, RFC_GPO1 (PA enable signal) is sometimes not de-asserted on CC1352 Rev A. We would see code like the following:

    GPIO_setMux(CONFIG_RF_HIGH_PA, IOC_PORT_RFC_GPO1);

    Btw, I believe this part of code only applies to boards with external PA/LNA, such as CC1312R + CC1190. In several posts on this forum on how to use CC131R with CC1190, including one thread started by me, we were advised to route GPIO pin connected to external PA/LNA as the following:

        // Route out LNA active pin to CONFIG_GPIO_LNA
        GPIO_setConfigAndMux(CONFIG_GPIO_LNA, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW, IOC_PORT_RFC_GPO0);
        
        // Route out PA active pin to CONFIG_GPIO_PA
        GPIO_setConfigAndMux(CONFIG_GPIO_PA, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW, IOC_PORT_RFC_GPO1);

    If what stated in the comment of generated code is true, that sometimes RFC_GPO1 is not de-asserted when TX is completed, I would anticipate that will completely blow up battery life. And that's why I asked for clarification.

    Best regards,

    ZL

  • Hi Zhiyong,

    My understanding is that all the 352 kB versions of the CC13x2 devices have this issue, including CC1312.

    However it may not be relevant unless you need to implement an antenna switch callback.

    Cheers,

    Marie H