Jump to content
Sign in to follow this  
dcjw

How to set up LPDS for CC3200 in Energia?

Recommended Posts

Hi 

I would like to utilize LPDS mode for CC3200. I am following TI SDK idle_profile_nonos example. However, since my code was developed in Energia environment, I am trying to add PM related functions into my code. However, it doesn't enter sleep mode. 

Here is what I did. I really appreciate if anyone who is familiar with LPDS can share their experience.  

One issue I can think of now is, according to TI, they mentioned that we need to set up SimpleLinkSyncWaitLoopCallback to put MCU to sleep when it is idle. However, I am not sure how SimpleLinkSyncWaitLoopCallback is invoked in Energia  

http://e2e.ti.com/support/wireless-connectivity/wifi/f/968/p/769004/2848594#2848594

 

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

4. Since my wake up source is GPIO, I comment out Host IRQ and RTC portions in set_wkup_srcs

 

May I know if I am missing anything else?

Thanks,

Dennis

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...