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: 15.4 stack PA mode can not switch

Part Number: CC2652P
Other Parts Discussed in Thread: LAUNCHXL-CC1352P, SYSCONFIG, CC1352P, SIMPLELINK-CC13X2-26X2-SDK

Hi, I use CC2652P on my target, SimpleLink SDKv4.20. My application is based on TI154stack sensor_2_4g.

I find a strange phenomenon when I test 15.4 transmit power.

I use my target to Tx data, and use LaunchPad to receive.

If I use SmartRF Studio to control my target to Tx data with different tx power from -20dBm to 20dBm, then I can observe corresponding RSSI on LaunchPad.

But, if I use my own application to control my target to Tx data with different tx power from -20dBm to 20dBm, then RSSI on LaunchPad seems abnormal.

To be specific,

If tx power in syscfg is set from 14 to 20 dBm(high PA mode), then the target will always be high PA mode according to RSSI on LaunchPad whatever tx power I set from -20 to 20dBm using 

ApiMac_mlmeSetReqUint8(ApiMac_attribute_phyTransmitPowerSigned, (uint8_t)TxPower);

If tx power in syscfg is set from -20 to 5 dBm(No high PA mode), then the target will always be No high PA mode according to RSSI on LaunchPad whatever tx power I set from -20 to 20dBm using the same API above.

So it seems that PA mode is set within init procedure and after that, it can not switch on my own application, but PA mode works fine on SmartRF Studio.

Can you help me with this?

  • Hi yingtao,

    How are you switching between the PA and regular TX output paths on the CC2652P during runtime?  Did you replace a CC1352P on a LAUNCHXL-CC1352P (-2) or are you using a custom board which references this design?  SmartRF Studio 7 works because it automatically switches the output paths.  Please review rfDriverCallbackAntennaSwitching (generated in ti_drivers_config.c based on SysConfig settings) and the following E2E threads.

    https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/t/940912 
    https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz/f/156/t/926073 

    Regards,
    Ryan

  • I use custom board which references LAUNCHPAD CC1352P-2.

    I find there is a mac attribute 

    ApiMac_attribute_paType.

    Do I need to set this attribute when I set Tx power for example

    ApiMac_mlmeSetReqUint8(ApiMac_attribute_paType, 0);
    ApiMac_mlmeSetReqUint8(ApiMac_attribute_phyTransmitPowerSigned, (uint8_t)-10);

    or

    ApiMac_mlmeSetReqUint8(ApiMac_attribute_paType, 1);
    ApiMac_mlmeSetReqUint8(ApiMac_attribute_phyTransmitPowerSigned, 14);

  • If during runtime you are changing TX output paths that the RF core uses, whether the default or high-power PA, then this attribute should be changed accordingly.

    Regards,
    Ryan

  • Hi, I did some experiment to test PA switch.

    I switch PA mode every 500ms, partial code is as below

    static uint8_t pa_status = 0;
    
    if (pa_status == 0)
    {
    	ApiMac_mlmeSetReqUint8(ApiMac_attribute_paType, 0);
    	ApiMac_mlmeSetReqUint8(ApiMac_attribute_phyTransmitPowerSigned, (uint8_t)(-20));
    
    	pa_status = 1;
    }
    else
    {
    	ApiMac_mlmeSetReqUint8(ApiMac_attribute_paType, 1);
    	ApiMac_mlmeSetReqUint8(ApiMac_attribute_phyTransmitPowerSigned, (uint8_t)(20));
    
    	pa_status = 0;
    }
    
    Task_sleep(100*500);

    And, my rfDriverCallbackAntennaSwitching is as below

    void rfDriverCallbackAntennaSwitching(RF_Handle client, RF_GlobalEvent events, void *arg)
    {
        if (events & RF_GlobalEventInit) {
            PIN_Config antennaConfig[] = {
                    CONFIG_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,      /* Path disabled */
                    PIN_TERMINATE
                };
                antennaPins = PIN_open(&antennaState, antennaConfig);
        }
        else if (events & RF_GlobalEventRadioSetup) {
            /* Switch off all paths. */
            //PINCC26XX_setOutputValue(CONFIG_RF_24GHZ, 0);
            PINCC26XX_setOutputValue(CONFIG_RF_HIGH_PA, 0);
            //PINCC26XX_setOutputValue(CONFIG_RF_SUB1GHZ, 0);
    
            /* Decode the current PA configuration. */
            RF_TxPowerTable_PAType paType = (RF_TxPowerTable_PAType)RF_getTxPower(client).paType;
    
            /* 2.4 GHz */
            if (paType == RF_TxPowerTable_HighPA)
            {
                /* PA enable --> HIGH PA
                 * LNA enable --> 2.4 GHz
                 */
                //PINCC26XX_setMux(antennaPins, 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(antennaPins, CONFIG_RF_HIGH_PA, PINCC26XX_MUX_RFC_GPO3);
                //PINCC26XX_setMux(antennaPins, CONFIG_RF_SUB1GHZ, PINCC26XX_MUX_GPIO);
            } else {
    
                /* RF core active --> 2.4 GHz */
                //PINCC26XX_setMux(antennaPins, CONFIG_RF_24GHZ, PINCC26XX_MUX_GPIO);
                PINCC26XX_setMux(antennaPins, CONFIG_RF_HIGH_PA, PINCC26XX_MUX_GPIO);
                //PINCC26XX_setMux(antennaPins, CONFIG_RF_SUB1GHZ, PINCC26XX_MUX_GPIO);
                //PINCC26XX_setOutputValue(CONFIG_RF_24GHZ, 1);
            }
        }
        else if (events & RF_GlobalEventRadioPowerDown) {
            /* Switch off all paths. */
            //PINCC26XX_setOutputValue(CONFIG_RF_24GHZ, 0);
            PINCC26XX_setOutputValue(CONFIG_RF_HIGH_PA, 0);
            //PINCC26XX_setOutputValue(CONFIG_RF_SUB1GHZ, 0);
    
            /* Reset the IO multiplexer to GPIO functionality */
            //PINCC26XX_setMux(antennaPins, CONFIG_RF_24GHZ, PINCC26XX_MUX_GPIO);
            PINCC26XX_setMux(antennaPins, CONFIG_RF_HIGH_PA, PINCC26XX_MUX_GPIO);
            //PINCC26XX_setMux(antennaPins, CONFIG_RF_SUB1GHZ, PINCC26XX_MUX_GPIO);
        }
    }

    I set 15.4 transmit power in syscfg to 20 so that high PA mode is enabled.

    I use two LED to indicate program running.

    LED1 toggles each PA set in application.

    LED2 toggles each callback invoked.

    I find that, LED1 toggles every 500ms indicating that PA set every 500ms in application.

    And LED2 toggles every 500ms, each time LED2 toggles delay about 200us than LED1 toggles.

    This indicates that each time PA set in application, the callback will be invoked in 200us. It makes sense.

    However, the strange thing is that paType in callback is always RF_TxPowerTable_HighPA and program never goes into the else statement.

    And, I add some code to tx data after each PA set in application, then observe RSSI on LaunchPad controlled by SmartRF Studio.

    The RSSI is alternate -26 and -30.

    So it shows that the PA keeps enabled and can not be disabled.

    Please help me with this?

  • Hi yingtao,

    Can you please try the following and update us on the results?

    • Switch the order of ApiMac_mlmeSetReqUint8 calls
    • Call PINCC26XX_setMux based on your expectation of the paType instead of what is returned from RF_getTxPower

    Edit:

    SysConfig will only generate a power table for one of the ranges, default or high PA, inside ti_radio_config.c:

    // 2400 MHz, 5 dBm
    RF_TxPowerTable_Entry txPowerTable_2400_pa5[TXPOWERTABLE_2400_PA5_SIZE] =
    {
        {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(6, 3, 0, 2) },
        {-18, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 3) },
        {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 3) },
        {-12, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 3, 0, 5) },
        {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(15, 3, 0, 5) },
        {-9, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 3, 0, 5) },
        {-6, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 0, 8) },
        {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 3, 0, 9) },
        {-3, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 2, 0, 12) },
        {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 1, 0, 20) },
        {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 1, 0, 20) },
        {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 25) },
        {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(29, 1, 0, 28) },
        {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(35, 1, 0, 39) },
        {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(23, 0, 0, 57) },
        RF_TxPowerTable_TERMINATION_ENTRY
    };
    
    // 2400 MHz, 20 dBm
    RF_TxPowerTable_Entry txPowerTable_2400_pa20[TXPOWERTABLE_2400_PA20_SIZE] =
    {
        {14, RF_TxPowerTable_HIGH_PA_ENTRY(22, 3, 1, 19, 27) },
        {15, RF_TxPowerTable_HIGH_PA_ENTRY(26, 3, 1, 23, 27) },
        {16, RF_TxPowerTable_HIGH_PA_ENTRY(30, 3, 1, 28, 27) },
        {17, RF_TxPowerTable_HIGH_PA_ENTRY(37, 3, 1, 39, 27) },
        {18, RF_TxPowerTable_HIGH_PA_ENTRY(32, 3, 1, 35, 48) },
        {19, RF_TxPowerTable_HIGH_PA_ENTRY(34, 3, 1, 48, 63) },
        {20, RF_TxPowerTable_HIGH_PA_ENTRY(53, 3, 1, 58, 63) },
        RF_TxPowerTable_TERMINATION_ENTRY
    };

    In order to resolve the issue for your setup you will need to disable SysConfig and combine the tables:

    // 2400 MHz, 20 dBm
    RF_TxPowerTable_Entry txPowerTable_2400_pa20[TXPOWERTABLE_2400_PA20_SIZE] =
    {
        {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(6, 3, 0, 2) },
        {-18, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 3) },
        {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 3) },
        {-12, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 3, 0, 5) },
        {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(15, 3, 0, 5) },
        {-9, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 3, 0, 5) },
        {-6, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 0, 8) },
        {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 3, 0, 9) },
        {-3, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 2, 0, 12) },
        {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 1, 0, 20) },
        {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 1, 0, 20) },
        {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 25) },
        {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(29, 1, 0, 28) },
        {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(35, 1, 0, 39) },
        {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(23, 0, 0, 57) },
        {14, RF_TxPowerTable_HIGH_PA_ENTRY(22, 3, 1, 19, 27) },
        {15, RF_TxPowerTable_HIGH_PA_ENTRY(26, 3, 1, 23, 27) },
        {16, RF_TxPowerTable_HIGH_PA_ENTRY(30, 3, 1, 28, 27) },
        {17, RF_TxPowerTable_HIGH_PA_ENTRY(37, 3, 1, 39, 27) },
        {18, RF_TxPowerTable_HIGH_PA_ENTRY(32, 3, 1, 35, 48) },
        {19, RF_TxPowerTable_HIGH_PA_ENTRY(34, 3, 1, 48, 63) },
        {20, RF_TxPowerTable_HIGH_PA_ENTRY(53, 3, 1, 58, 63) },
        RF_TxPowerTable_TERMINATION_ENTRY
    };

    TXPOWERTABLE_2400_PA20_SIZE will also need to be increased accordingly in ti_radio_config.h (TXPOWERTABLE_2400_PA20_SIZE + TXPOWERTABLE_2400_PA5_SIZE -1)

    Regards,
    Ryan

  • Hi,

    1, Switch the order of ApiMac_mlmeSetReqUint8 calls

    static uint8_t pa_status = 0;
    
    pa_status = (pa_status == 0 ? 1 : 0);

    if (pa_status == 0) { ApiMac_mlmeSetReqUint8(ApiMac_attribute_phyTransmitPowerSigned, (uint8_t)(-20)); ApiMac_mlmeSetReqUint8(ApiMac_attribute_paType, 0); } else { ApiMac_mlmeSetReqUint8(ApiMac_attribute_phyTransmitPowerSigned, (uint8_t)(20)); ApiMac_mlmeSetReqUint8(ApiMac_attribute_paType, 1); } Task_sleep(100*500);

    The paType in callback is still always HighPA.

    2, Call PINCC26XX_setMux based on your expectation of the paType instead of what is returned from RF_getTxPower,

     Yes, this time the RSSI on LaunchPad alternates between -21 and -55. Also my DIO29 waveform alternates between high PA and standard mode every 500ms.

    This is what expected.

    Now it seems that ApiMac_attribute_paType does not work.

    Maybe I should try disable syscfg and combine txPowerTable_2400_pa5 and txPowerTable_2400_pa20 as you said.

  • Hi yingtao,

    You will need to disable SysConfig and combine power tables for this application to work, please report your findings after doing so.

    Regards,
    Ryan

  • Hi,

    I tried disable syscfg and combined power tables, and it worked.

    My target tx data from -20dBm to 20dBm, RSSI on LaunchPad varies from -60 to -20.

    This is totally what I expected.

    But I don't think disabling syscfg is a good idea because if I need to change something in syscfg some time later, then I must do all these procedure again.

    I found another method which can keep syscfg enabled.

    There is a RfCfg in rfSelect which is used to init macTask in OSAL as below:

    The power table pointer is assigned to this RF_CONFIG_250KBPS_IEEE_PHY_0 in mac_user_config.h

    So I add a new RF_CONFIG_250KBPS_IEEE_PHY_0_PATCH in mac_user_config.h.

    In RF_CONFIG_250KBPS_IEEE_PHY_0_PATCH, I use combined power table as below:

    ///////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////
    #define TXPOWERTABLE_2400_PA20_SIZE_PATCH_BY_JYT (TXPOWERTABLE_2400_PA20_SIZE + TXPOWERTABLE_2400_PA5_SIZE - 1)
    
    RF_TxPowerTable_Entry txPowerTable_2400_pa20_patch_by_jyt[TXPOWERTABLE_2400_PA20_SIZE_PATCH_BY_JYT] =
    {
        {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(6, 3, 0, 2) },
        {-18, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 3) },
        {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 3) },
        {-12, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 3, 0, 5) },
        {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(15, 3, 0, 5) },
        {-9, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 3, 0, 5) },
        {-6, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 0, 8) },
        {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 3, 0, 9) },
        {-3, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 2, 0, 12) },
        {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 1, 0, 20) },
        {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 1, 0, 20) },
        {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 25) },
        {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(29, 1, 0, 28) },
        {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(35, 1, 0, 39) },
        {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(23, 0, 0, 57) },
    
        {14, RF_TxPowerTable_HIGH_PA_ENTRY(22, 3, 1, 19, 27) },
        {15, RF_TxPowerTable_HIGH_PA_ENTRY(26, 3, 1, 23, 27) },
        {16, RF_TxPowerTable_HIGH_PA_ENTRY(30, 3, 1, 28, 27) },
        {17, RF_TxPowerTable_HIGH_PA_ENTRY(37, 3, 1, 39, 27) },
        {18, RF_TxPowerTable_HIGH_PA_ENTRY(32, 3, 1, 35, 48) },
        {19, RF_TxPowerTable_HIGH_PA_ENTRY(34, 3, 1, 48, 63) },
        {20, RF_TxPowerTable_HIGH_PA_ENTRY(53, 3, 1, 58, 63) },
    
        RF_TxPowerTable_TERMINATION_ENTRY
    };
    
    #define txPowerTable_ieee154_patch_by_jyt txPowerTable_2400_pa20_patch_by_jyt
    
    #define RF_CONFIG_250KBPS_IEEE_PHY_0_patch_by_jyt   {                                                                  \
         &RF_prop_ieee154,                                                                          \
         txPowerTable_ieee154_patch_by_jyt,                                                                      \
         (const rfc_CMD_RADIO_SETUP_PA_t *)&RF_cmdRadioSetup_ieee154,                               \
         (const rfc_CMD_FS_t *)&RF_cmdFs_ieee154,                                                   \
         (const rfc_CMD_IEEE_TX_t *)&RF_cmdIeeeTx_ieee154,                                          \
         (const rfc_CMD_IEEE_RX_t *)&RF_cmdIeeeRx_ieee154,                                          \
         (const rfc_CMD_IEEE_CSMA_t *)&RF_cmdIeeeCsma_ieee154,                                      \
         (const rfc_CMD_IEEE_RX_ACK_t *)&RF_cmdIeeeRxAck_ieee154,                                   \
         (void *)NULL                                                                               \
    }
    ////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////

    In rfSelect, change code as below:

    //macRfCfg_ieee_t RfCfg = RF_CONFIG_250KBPS_IEEE_PHY_0;
    macRfCfg_ieee_t RfCfg = RF_CONFIG_250KBPS_IEEE_PHY_0_patch_by_jyt;

    Now, everything works.

  • Hi yingtao,

    Thank you for verifying the issue/solution and providing your workaround.  I will coordinate with the SysConfig developers to ensure that the power table generation problem is resolved in the next SIMPLELINK-CC13X2-26X2-SDK version.

    Regards,
    Ryan

  • It's good to resolve this problem in the next SDK version.

    I guess the true reason is that 

    ApiMac_mlmeSetReqUint8(ApiMac_attribute_paType, pa_type);

    ApiMac_attribute_paType set does not work.This set should update power table pointer to some where in SDK so that RF_getTxPower in callback can get correct paType from the corresponding power table.