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.

LAUNCHXL-CC1310: Power Modes API's

Part Number: LAUNCHXL-CC1310
Other Parts Discussed in Thread: CC1310

Hello TI Team

Can I use PowerCC26XX_standbyPolicy() this API to put my MCU into standby mode in non-RTOS application? I am using CC1310 launchxl. If yes should I directly call this API or I need to do some other configurations or call as well?

  • Hi,

    You can take a look at the Power management user guide.

    Please let me know if you have any further questions after reading this.

    Regards,
    Nikolaj

  • Hi,

    PowerCC26XX_standbyPolicy() is not intended to be called by the application (please refer to section 2.5 in Power management user guide.)

    Assuming the project is configured correctly (i.e. the Power policy is set to PowerCC26XX_standbyPolicy() and the policy is enabled) you could use Power_idleFunc()

    If you for example use the gpiointerrupt_CC1310_LAUNCHXL_nortos_ccs example from the SDK and add the Power_idleFunc() to the while(1) loop in the main function (as shown below), the device will enter standby and stay in standby until a GPIO interrupt.

    /*
     *  ======== main_nortos.c ========
     */
    #include <stdint.h>
    #include <stddef.h>
    
    #include <NoRTOS.h>
    #include <ti/drivers/Power.h>
    
    /* Example/Board Header files */
    #include <ti/drivers/Board.h>
    
    extern void *mainThread(void *arg0);
    
    /*
     *  ======== main ========
     */
    int main(void)
    {
        /* Call driver init functions */
        Board_init();
    
        /* Start NoRTOS */
        NoRTOS_start();
    
        /* Call mainThread function */
        mainThread(NULL);
    
        while (1) {
            Power_idleFunc();
        }
    }


    Keep in mind that the device will not enter standby mode for infinite time, the power driver will schedule a wakeup at some point (far) in the future, even if no other wakeup has been scheduled.

    You could just as well use the sleep() API with a high sleep time, which might be a better solution since Power_idleFunc is not listed as an API that is intended to be used by the application (please again refer to section 2.5 in Power management user guide.)

    Regards,
    Nikolaj

  • 1. How can I configure PowerCC26XX_standbyPolicy() in my project?  (i.e. the Power policy is set to PowerCC26XX_standbyPolicy() and the policy is enabled)

    2. What is the need of using Power_idleFunc() when I configured the PowerCC26XX_standbyPolicy() in my project?

    3. Can I use PowerCC26XX_standbyPolicy() API for Non-RTOS applications?

  • 1.: This is already set up correctly in the gpiointerrupt_CC1310_LAUNCHXL_nortos_ccs example. You can take a look at the CC1310_LAUNCHXL.c file. It contains the following code:

    /*
     *  =============================== Power ===============================
     */
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerCC26XX.h>
    
    const PowerCC26XX_Config PowerCC26XX_config = {
        .policyInitFxn      = NULL,
        .policyFxn          = &PowerCC26XX_standbyPolicy,
        .calibrateFxn       = &PowerCC26XX_calibrate,
        .enablePolicy       = true,
        .calibrateRCOSC_LF  = true,
        .calibrateRCOSC_HF  = true,
    };

    2.: The use of Power_idleFunc() ensures that the policy function (in your case PowerCC26XX_standbyPolicy()) is only called when appropriate (only when the policy is enabled).

    3.:Yes, for example PowerCC26XX_standbyPolicy() will be used by the Power_idleFunc() in my modified version of the the gpiointerrupt_CC1310_LAUNCHXL_nortos_ccs example, which is a Non-RTOS example.

  • After this configuration do I need to call Power_init(),  Power_enablePolicy() & Power_setPolicy() API's in my main() function or I directly call the Power_idleFunc() wherever i need it?

  • You do not need to call Power_enablePolicy() or Power_setPolicy(), but you do need to call Power_init(). This is normally done in the Board_init() function. You can again refer to the gpiointerrupt_CC1310_LAUNCHXL_nortos_ccs example.

  • In the Standby mode, the RFCORE_PD should be off according to the cc1310 user guide. But in my project, even after calling the Power_idleFunc(), the RFCORE_PD remains ON. The RFC_ON bit remains set in the PDCTL0 register in PRCM registers during Power_idleFunc() is called.

    What can be the cause of this problem?

  • Hi,

    How are you reading PRCM::PDCTL0::RFC_ON after calling Power_idleFunc()? You are not expected to be able to read this value while the device is in standby? Keep in mind that Power_idleFunc() will not return until the device has exits standby (if it ever entered standby)

    Also, I don't believe the device will actually enter standby while the debugger is connected.

    You also need to make sure that there are no constraints (refer to Power management user guide) preventing the power management to enter standby. You can debug through the PowerCC26XX_standbyPolicy function to see if a constraint is preventing the device to enter standby.

    Regards,
    Nikolaj

  • Hello,
    Sorry for the late reply.
    While debugging after calling Power_idleFunc(). some registers are visible while some are not & PRCM::PDCTL0:RFC_ON was visible.

    while debugging the PowerCC26XX_standbyPolicy() it is entering into the idle state. I tried to check the set constraints using Power_getConstraintMask API. it returned a value of 4. Then I tried to clear this constraint using Power_releaseConstraint(). But still, it is entering into the idle state.

    following is the snippet of the code

    Power_enablePolicy();

    while(1)
    {
    mask = Power_getConstraintMask();
    status = Power_releaseConstraint(4);
    if (status != Power_SOK) {
    // Error occurred releasing constraint
    }
    Power_idleFunc();
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED0, 1);
    __delay_cycles(240000);
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED0, 0);
    }

  • Hi,

    The first few times Power_idleFunc() is called, there might be a constraint causing the device to enter idle state. (I think the power driver is waiting for a clock to be ready)

    You should not release the constraint in your code.

    Regards,
    Nikolaj

  • Even after calling 5-6 times, it is not entering into standby.

  • Hi,

    Are you using the gpiointerrupt_CC1310_LAUNCHXL_nortos_ccs example with the modification I previously suggested? If not, can you try to use that example and let me know if you experience the same issue?

    Regards

    Nikolaj

  • I tried using the gpiointerrupt_CC1310_LAUNCHXL_nortos_ccs example. Still, I am facing the same issue.

  • Are you using a CC1310 LaunchPad or a custom board?

    while debugging the PowerCC26XX_standbyPolicy() it is entering into the idle state.
    Even after calling 5-6 times, it is not entering into standby.

    Are saying that PRCMDeepSleep() is always called and that Power_sleep() is never called? 

  • Yes, I am using cc1310 launchpad.

    Yes PRCMDeepSleep() is always called and Power_sleep() is never called.

  • Hi Gopal,

    Can you please report the values of AUX_DDI0_OSC::CTL0::SCLK_LF_SRC_SEL and AUX_DDI0_OSC::STAT0::SCLK_LF_SRC throughout the execution of the modified gpiointerrupt_CC1310_LAUNCHXL_nortos_ccs example? 

    Can you also set a breakpoint at lfClockReadyCallback (in PowerCC26XX.c) and determine if the power constraint is released, and if it is not released can you report why? Note, lfClockReadyCallback might setup a clock to call lfClockReadyCallback  again later, so the constraints might not be released the first time lfClockReadyCallback is called.

    Thanks,
    Nikolaj