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.

  • Resolved

CC3200: How to enter LPDS successfully in STA mode?

Intellectual 440 points

Replies: 14

Views: 568

Part Number: CC3200

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
  • In reply to Benjamin Moore:

    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;
    }

  • In reply to Dennis Wang22:

    Hi Dennis,

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

    Best,
    Ben M
  • In reply to Benjamin Moore:

    Hi Ben,

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

    Thanks,

    Dennis

  • In reply to Dennis Wang22:

    Hi Dennis,

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

    Best,
    Ben M
  • In reply to Benjamin Moore:

    Hi Ben,

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

  • In reply to Dennis Wang22:

    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
  • In reply to Benjamin Moore:

    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? 

  • In reply to Dennis Wang22:

    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
  • In reply to Benjamin Moore:

    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?

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.