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.

CC2652P: truth table of the switch

Part Number: CC2652P
Other Parts Discussed in Thread: CC1352P, SYSCONFIG

Hi, 

in our reference design and SDK release, the truth table is two bits to control the normal power/RX and high power port. 

now, customer wants to use one bit switch. 

High power: "1"

Normal power/RX: "0"

Do you comment if it is okay? How?

Thanks. 

BR. Albin

  • The reference design for CC2652P is CC1352P based since the latter is a super set device. Hence the reference design etc uses a 3:1 switch since CC1352P has 3 RF interfaces. CC2652P has 2 RF interfaces meaning that only a 2:1 switch is required and hence only one control line, as suggested by the customer, is required. 

  • Torestein, 

    yes. 

    my question is about the SW implementation. do you comment? 

    in our code, two DIOs are assigned for the two channels. 1, 0 for normal and 0, 1 for high power. 

    the 2:1 switch customer selected is one DIO, 1 of high power, 0 for normal. 

    BR. Albin

  • Could you be more specific on which code you are referring to? I would assume that this is done slightly differently depending on which code from the SDK you are using. 

  • could you make an example on the BLE peripheral? 

    Thanks. 

    Albin

  • Hi Albin,

    1. Disable SysConfig (details can be found here)

    2. Modify the content of the ti_drivers_config.c (this file is usually generated by SysConfig, so it is important to disable it before). All the references to CONFIG_RF_SUB1GHZ can be removed. Especially in the table BoardGpioInitTable[] and in the functions initRfFrontend() and rfDriverCallback(). You should get the following:

    /*
     *  =============================== PIN ===============================
     */
    
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/pin/PINCC26XX.h>
    
    const PIN_Config BoardGpioInitTable[] = {
        /* XDS110 UART, Parent Signal: CONFIG_DISPLAY_UART TX, (DIO13) */
        CONFIG_PIN_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MED,
        /* XDS110 UART, Parent Signal: CONFIG_DISPLAY_UART RX, (DIO12) */
        CONFIG_PIN_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN | PIN_IRQ_DIS,
        /* LaunchPad Button BTN-1 (Left), Parent Signal: CONFIG_GPIO_BTN1 GPIO Pin, (DIO15) */
        CONFIG_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_DIS,
        /* LaunchPad Button BTN-2 (Right), Parent Signal: CONFIG_GPIO_BTN2 GPIO Pin, (DIO14) */
        CONFIG_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_DIS,
        /* CONFIG_RF_24GHZ (DIO28) */
        CONFIG_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        /* CONFIG_RF_HIGH_PA (DIO29) */
        CONFIG_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    
        PIN_TERMINATE
    };
    
    const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
        .intPriority = (~0),
        .swiPriority = 0
    };
    
    
    
    // ....
    
    /*
     *  =============================== RF Front-end ===============================
     */
    
    /*
     * ======== Front-end control ========
     */
    static PIN_Handle frontendPins;
    static PIN_State frontendState;
    
    void initRfFrontend(void)
    {
        static bool initialized = false;
    
        if (!initialized) {
            PIN_Config frontendConfig[] = {
                CONFIG_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,      /* Path disabled */
                CONFIG_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,      /* Path disabled */
                PIN_TERMINATE
            };
            frontendPins = PIN_open(&frontendState, frontendConfig);
            initialized = true;
        }
    }
    
    /*
     *  =============================== RF Driver ===============================
     */
    
    #include <ti/drivers/rf/RF.h>
    /*
     *  Board-specific callback function to set the correct antenna path.
     *
     */
    static void rfDriverCallback(RF_Handle client, RF_GlobalEvent event, void* arg);
    
    const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
        .hwiPriority        = (~0),
        .swiPriority        = (uint8_t)0,
        .xoscHfAlwaysNeeded = true,
        .globalCallback     = rfDriverCallback,
        .globalEventMask    = RF_GlobalEventRadioPowerDown | RF_GlobalEventRadioSetup
    };
    
    /*
     * ======== rfDriverCallback ========
     * Sets up the antenna switch depending on the current PHY configuration.
     * Truth table:
     *
     * Path        DIO28 DIO29 DIO30
     * =========== ===== ===== =====
     * Off         0     0     0
     * Sub-1 GHz   0     0     1
     * 2.4 GHz     1     0     0
     * 20 dBm TX   0     1     0
     */
    static void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void *arg)
    {
        /* Local variable. */
        bool    sub1GHz   = false;
        uint8_t loDivider = 0;
    
        /* Initialize front-end (will only be done once) */
        initRfFrontend();
    
        /* Switch off all paths first. Needs to be done anyway in every sub-case below. */
        PINCC26XX_setOutputValue(CONFIG_RF_24GHZ, 0);
        PINCC26XX_setOutputValue(CONFIG_RF_HIGH_PA, 0);
    
        if (events & RF_GlobalEventRadioSetup) {
            /* 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
                     */
                    PINCC26XX_setMux(frontendPins, CONFIG_RF_24GHZ, PINCC26XX_MUX_GPIO);
                    /* Note: RFC_GPO3 is a work-around because the RFC_GPO1 (PA enable signal) is sometimes not
                             de-asserted on CC1352 Rev A. */
                    PINCC26XX_setMux(frontendPins, CONFIG_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3);
                } else {
                    /* RF core active --> Sub-1 GHz */
                    PINCC26XX_setMux(frontendPins, CONFIG_RF_24GHZ, PINCC26XX_MUX_GPIO);
                    PINCC26XX_setMux(frontendPins, CONFIG_RF_HIGH_PA, PINCC26XX_MUX_GPIO);
                }
            } else {
                /* 2.4 GHz */
                if (paType == RF_TxPowerTable_HighPA)
                {
                    /* PA enable --> HIGH PA
                     * LNA enable --> 2.4 GHz
                     */
                    PINCC26XX_setMux(frontendPins, CONFIG_RF_24GHZ, PINCC26XX_MUX_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. */
                    PINCC26XX_setMux(frontendPins, CONFIG_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3);
                } else {
                    /* RF core active --> 2.4 GHz */
                    PINCC26XX_setMux(frontendPins, CONFIG_RF_24GHZ, PINCC26XX_MUX_GPIO);
                    PINCC26XX_setMux(frontendPins, CONFIG_RF_HIGH_PA, PINCC26XX_MUX_GPIO);
                    PINCC26XX_setOutputValue(CONFIG_RF_24GHZ, 1);
                }
            }
        } else {
            /* Reset the IO multiplexer to GPIO functionality */
            PINCC26XX_setMux(frontendPins, CONFIG_RF_24GHZ, PINCC26XX_MUX_GPIO);
            PINCC26XX_setMux(frontendPins, CONFIG_RF_HIGH_PA, PINCC26XX_MUX_GPIO);
        }
    }

    Unfortunately I could not test my code (I do not have the appropriate HW). So please let me know if something is not completely correct.

    Thanks,