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.

CC3200: How to enter LPDS successfully in STA mode?

Part Number: CC3200
Other Parts Discussed in Thread: ENERGIA,

Hi 

I am referencing to idle profile non os version application. I want to enter LPDS mode when a GPIO pin (for example, GP28) is set to LOW and wake up by a valid GPIO pin (for example, GP17). However, when I try to drive the pin LOW, it doesn't go into LPDS and still continues to execute the loop. Thus, I would like to confirm if I am missing anything. If I understood correctly, to enter LPDS mode, we need to following steps:

1. I am using Energia IDE to develop my code. In setup(), I include PM Initialization

struct platform_pm_ops lp3p0_pm_ops;

/* Initialize the PM framework */
if (cc_pm_framework_init()){
   Serial.println("Error: PM framework init failed");
   while(1);
}
/* Get the SOC specific platform operations */
lp3p0_get_pm_ops(&lp3p0_pm_ops);

/* Register PM ops with framework */
if(cc_pm_platform_ops_register(&lp3p0_pm_ops)){
Serial.println("Error: PM framework init failed");
while(1);
}

/* Register the interrupt with the global interrupt handler */
MAP_IntRegister(INT_PRCM, prcm_interrupt_handler);

/* Enable the interrupt */
MAP_IntEnable(INT_PRCM);

2. In loop(), if GP28 is LOW, then I do the following

if (sl_WlanPolicySet(SL_POLICY_PM, SL_NORMAL_POLICY, NULL, 0) < 0)
{
   Serial.println("Error: unable to configure network power policy\n\r");
   while(1);//LOOP_FOREVER();
}
// set up gpio handler
lp3p0_setup_power_policy(1); // 0: POWER_POLICY_SLEEP; 1: POWER_POLICY_STANDBY

// just to clear any pending event
_SlNonOsMainLoopTask();

set_gpio_as_wk_src(0, 0x3, 0); // WK_LPDS = 0x0, GPIO_SRC_WKUP = 0x3, PRCM_LPDS_HIGH_LEVEL = 0x0

cc_idle_task_pm();

3. The functions above are directly from lp3p0_plat_ops.c. However, since I only want to use GPIO as the wake up source, I modify the interrupt handler as follows 

void prcm_interrupt_handler() {
   int status;

/* Read the interrupt status, also clears the status */
   status = MAP_PRCMIntStatus();

   if (0 == status) {
/* Invoke the wake from LPDS interrupt handler */
      wake_interrupt_handler();
   } else {
   }
}

May I know if I am missing anything else?

Thanks,

Dennis

  • Hi Dennis,

    Check to make sure both the RTC and host IRQ from the NWP are not enabled as wake sources which could prevent the system from sleeping.

    Best,
    Ben M
  • Hi Ben,

    I try to comment out the following Host IRQ and RTC portions in set_wkup_srcs, but it still doesn't seem to enter LPDS mode successfully. Do I need to modify lp3p0_get_pm_ops, wake_interrupt_handler or other functions?

    if(lpds_wk_info.wk_type & WK_HOST_IRQ)
    {
       /* Set LPDS Wakeup source as NWP request */
       MAP_PRCMLPDSWakeupSourceEnable(PRCM_LPDS_HOST_IRQ);
       iRetVal = 0;
    }

    if(lpds_wk_info.wk_type & WK_RTC)
    {
       /* Setup the LPDS wake time */
       MAP_PRCMLPDSIntervalSet(lpds_wk_info.timer_interval * 32768);
       /* Enable the wake source to be timer */
       MAP_PRCMLPDSWakeupSourceEnable(PRCM_LPDS_TIMER);
       iRetVal = 0;
    }

  • Hi Dennis,

    Do you have any active peripherals in the system other when you are trying to enter lpds?

    Best,
    Ben M
  • Hi Ben,

    I have active timer running, is it ok? And how to tell if I have other active peripherals?

    Thanks,

    Dennis

  • Hi Dennis,

    By "active timer" do you mean a general purpose timer based on the fast clock?

    Best,
    Ben M
  • Hi Ben,

    I called PRCMPeripheralClkEnable(ePeripheral function with PRCM_RUN_MODE_CLK. Is this considered as fast clock?

  • Hi Dennis,

    I believe I missed an important detail on this issue, the fact that you are using Energia. How are you building your energia project with the power management framework? Have you run the idle_profile_nonos project from the SDK with CCS first and seen this work?

    Thanks,
    Ben M
  • Hi Ben,

    Yes, I have studied idle_profile_nonos project and I invoke the necessary functions that I think I need. These functions are available in Energia. 

    However, there is one function that I am not so sure. I copy simplelinksyncwaitloopcallback to Energia environment, but I don't think it is invoked by other functions. I studied idle_profile_nonos project, and I also couldn't tell how it is invoked. Do you know how to set up simplelinksyncwaitloopcallback? 

  • Hi Dennis,

    What do you mean by these functions are available in Energia? Can you point me to what you are looking at?

    I don't think Energia supports all the different build configurations of the host driver. The function you are referring to is designed to be defined in the application code and connected to the internal "_SlSyncWaitLoopCallback()" function used inside the host driver. You can see it in the "nonos.c" file. The definition in the application is connected to the host driver in the user.h file with "#define _SlSyncWaitLoopCallback SimpleLinkSyncWaitLoopCallback", but the host driver has to be rebuilt when this is added to support the call.

    Best Regards,
    Ben M
  • Hi Ben,

    The functions I referred to were the PM related ones in the very first post. It seems like Energia supports them so there is no compile error.

    So if I understand correctly, you are saying CCS supports many build configurations of the host driver while Energia doesn't, so simplelinksyncwaitloopcallback won't be able to invoked successfully?

  • Hi Dennis,

    I'm not sure why it is compiling, but no, I don't believe it is supported. In order for that example to work, you need to be able to link both our middleware library and a specific build of our simplelink library (host driver) to the application. The middleware library contains the power management framework which will determine when/how the device is put into a low power mode. Additionally, there are some platform specific files (lp3p0_board.c / lp3p0_plat_ops.c) that are necessary for the framework to work as expected too. The simplelink library build must be a specific configuration that supports the power management framework for that additional function (to which you are referring in your last post) to be relevant. It's not supported in Energia.

    Best,
    Ben M
  • Hi Ben,

    The reason I didn't get compile error because I can include middleware and simplelink libraries in Energia. I think Energia ported some libraries into the environment. I also include lp3p0_board.c / lp3p0_plat_ops.c into my project. In this case, can the PM framework work properly? Or perhaps there are additional libraries required? I can check if it is available in Energia

    Thanks,

    Dennis

  • Hi Dennis,

    I can't guarantee that will work. Again, this is not something that is supported in Energia. However, it is supported with our CC3200 SDK designed to work with CCS and the code will be the same if you switch. Plus, CCS is completely free to download and use.
    www.ti.com/.../CCSTUDIO

    Please work with it there.

    Best Regards,
    Ben M
  • Got it. Our existing code was initially developed in Energia. It contains 2000+ lines of code, so it is a bit hard to switch to CC3200 SDK... but I will try to see what I can do. Thanks!